diff --git a/z1.c b/z1.c deleted file mode 100644 index ab4176a..0000000 --- a/z1.c +++ /dev/null @@ -1,34 +0,0 @@ -void select_name() -{char name[10]; -int m; -printf("请输入姓名:"); -scanf("%s",name); -for(m=0;m +#include +#include + +struct time { + int hour; + int minute; +}; + struct Student { + long int xuehao; + char banji[10]; + char name[10]; + int time_hour; + int time_minute; + struct time begin,end; +} ; +struct Student student[30]; +static int i=0,j; +void save(); +void insert(); +void end_money(); +void delete_student(); +void select_xuehao(); +void select_name(); +void select_banji(); +void show(); +int main() { + int menu(); + int i; + for(;;) + { + printf("\t\t*******************菜单**************\n"); + printf("\t\t\n"); + printf("\t\t\n"); + printf("\t\t***************机房收费管理系统*******\n"); + printf("\t\t\n"); + printf("\t\t\n"); + printf("\t\t1.###############输入学生信息:########\n"); + printf("\t\t2.#################上机费用:##########\n"); + printf("\t\t3.################删除档案:###########\n"); + printf("\t\t4.################按学号查询:#########\n"); + printf("\t\t5.################按班级查询:#########\n"); + printf("\t\t6.################按姓名查询:#########\n"); + printf("\t\t7.################显示学生信息:#######\n"); + printf("\t\t8.##################退出系统:#########\n"); + printf("\n\n\n\n请在(1-8)之间选择功能:"); + scanf("%d",&i); + + switch(i) + { + case 1: + { + system("cls"); + insert(); + } + break; + case 2: + { + system("cls"); + end_money(); + } + break; + case 3: + { + system("cls"); + delete_student(); + } + break; + case 4: + { + system("cls"); + select_xuehao(); + } + break; + case 5: + { + system("cls"); + select_banji(); + } + break; + case 6: + { + system("cls"); + select_name(); + } + break; + case 7: + { + system("cls"); + show(); + } break; + case 8: + { + exit(0); + } + break; + } + } + printf("\n"); system("pause"); + + save(); + return 0; + +} +void insert() { + printf("请输入学号:"); + scanf("%ld",&student[i].xuehao); + + printf("请输入姓名:"); + scanf("%s",student[i].name); + + printf("请输入班级:"); + scanf("%s",student[i].banji); + + printf("请输入上机时间:"); + scanf("%d:%d",&student[i].begin.hour,&student[i].begin.minute); + i = i + 1; + printf("人数:%d",i); + j=i; + save(); + printf("\n"); system("pause"); + system("cls"); +} +void end_money() { + int m,minute,hour; + char xuehao; + printf("请输入学号:"); + scanf("%ld",&xuehao); + for(m = 0; m < i; m++) + { + if(student[m].xuehao==xuehao) + { + printf("请输入%ld的下机时间:",xuehao); + scanf("%d:%d",&student[m].end.hour,&student[m].end.minute); + if(student[m].end.minute 0) + { + hour = hour + 1; + printf("上机时间为:%d:%d 费用为:%d",student[m].time_hour,student[m].time_minute,hour); + } + else { + printf("上机时间为:%d:%d\n 费用为:%d",student[m].time_hour,student[m].time_minute,hour); + } + } + } + save(); + printf("\n"); system("pause"); + system("cls"); +} +void delete_student() +{ + long int xuehao; + int m; + printf("请输入学号:"); + scanf("%ld",&xuehao); + if(i==1) +{ + if(student[m].xuehao==xuehao) + printf("没有数据!"); + } +else{ + for(m=0;m