diff --git a/机房收费管理系统最初模型(主菜单).cpp b/机房收费管理系统最初模型(主菜单).cpp index beeec47..a5787ac 100644 --- a/机房收费管理系统最初模型(主菜单).cpp +++ b/机房收费管理系统最初模型(主菜单).cpp @@ -1,37 +1,248 @@ #include #include +#include + struct { - char id[15]; + char id[20]; char name[20]; char _class[5]; char online[1]; + float _fee; float begin_hour; float begin_min; float end_hour; float end_min; -}student[10]; -int i,j,k,m; +}student[15]; + +void dengji(); +void shangji(); +void fee(); +void xiugai(); +void chaxun(); + +int i,k,m; + int main(void) { int select; - printf("*************ӭշѹϵͳ*************\n"); - printf(" 1.ѧǼ\n"); - printf(" 2.ϻ\n"); - printf(" 3.޸ѧϢ\n"); - printf(" 4.ѯѧϢ\n"); - printf(" 5.˳ϵͳ\n"); - printf("*************ӭշѹϵͳ*************\n"); - printf("ѡ:"); + do + { + printf("*****************ӭշѹϵͳ*****************\n"); + printf(" 1.ѧǼ\n"); + printf(" 2.ѧϻʱ\n"); + printf(" 3.ѧ»ʱ估\n"); + printf(" 4.޸ѧϢ\n"); + printf(" 5.ѯѧϢ\n"); + printf(" 6.˳ϵͳ\n"); + printf("*****************ӭշѹϵͳ*****************\n"); + printf(" ѡ:"); scanf("%d",&select); switch(select) { -//case 1: dengji(); break; -//case 2: fee();break; -//case 3: xiugai();break; -//case 4: chaxun();break; -//case 5: break; -default: printf("ûиùѽ"); +case 1: getchar(); + dengji(); + break; + +case 2: getchar(); + shangji(); + break; + +case 3:getchar(); + fee(); + break; + +case 4:getchar(); + xiugai(); + break; + +case 5:getchar(); + chaxun(); + break; + +case 6: break; + +default:break; } +system("cls"); +}while(select!=6); + return 0; + } + +void dengji() //ѧϢ// +{ + static int j=0; + system("cls"); + printf("****************ѧϢǼ****************\n"); + for(i=j;i<15;i++) + { + char c; + printf("༶:"); + gets(student[i]._class); + printf("ѧ:"); + gets(student[i].id); + printf(":"); + gets(student[i].name); + printf("Ƿ룿(YN)"); + scanf("%c",&c); + if(c=='N'||c=='n') + { + j=i+1; + break; + } + getchar(); + printf("\n"); + } +} + +void shangji() //ϻ// +{ + char _id[20]; + system("cls"); + printf("****************ϻʱǼ****************\n"); + printf("ϻѧѧ:"); + gets(_id); + for(i=0;i<15;i++) +{ + if(strcmp(_id,student[i].id)==0) + { + printf("ϻʱ:"); + scanf("%f:%f",&student[i].begin_hour,&student[i].begin_min); + printf("һ........\n"); + system("pause"); + break; + } +} + if(i==14) + { + printf(" Ϣδ¼!\n"); + printf(" һ........\n"); + system("pause"); + + } + +} + +void fee() //»// +{ + char _id[20]; + system("cls"); + printf("****************»ʱ估õǼ****************\n"); + printf("ÿСʱ5Ԫ\n"); + printf("»ѧѧ:"); + gets(_id); + for(i=0;i<15;i++) +{ + if(strcmp(_id,student[i].id)==0) + { + if(!(student[i].begin_hour&&student[i].begin_min)) + { + printf("δϻ!\n"); + system("pause"); + break; + } + printf("»ʱ:"); + scanf("%f:%f",&student[i].end_hour,&student[i].end_min); + student[i]._fee=(student[i].end_hour+student[i].end_min/60-student[i].begin_hour-student[i].end_min/60)*5; + printf("Ϊ:%.1f\n",student[i]._fee); + printf("һ........\n"); + system("pause"); + break; + } +} + if(i==14) + { + printf(" Ϣδ¼!\n"); + printf(" һ........\n"); + system("pause"); + } + +} + +void chaxun() //ѯ// +{ + system("cls"); + printf("*************************************ѧϢѯ*************************************\n"); + printf("༶\t\t"); + printf("ѧ\t\t"); + printf("\t\t"); + printf("ϻʱ\t"); + printf("»ʱ\t"); + printf("ϻ\t"); + printf("״̬\n"); + for(i=0;i<15;i++) + { + printf("%s\t\t",student[i]._class); + printf("%s\t\t",student[i].id); + printf("%s\t\t",student[i].name); + printf("%g:%g\t\t",student[i].begin_hour,student[i].begin_min); + printf("%g:%g\t\t",student[i].end_hour,student[i].end_min); + printf("%.1f\t\t",student[i]._fee); + if(student[i].begin_hour==0) + printf("δϻ"); + else if(student[i].begin_hour!=0&&student[i].end_hour==0) + printf(""); + else if(student[i].begin_hour!=0&&student[i].end_hour!=0) + printf(""); + printf("\n"); + } + printf("*************************************ѧϢѯ*************************************\n"); + printf("\n\nһ"); + getchar(); +} + +void xiugai() //޸// +{ + char _id[20],name[20],banji[5]; + int eh,em,n,bh,bm; + system("cls"); + printf("****************޸ѧϢ****************\n"); + printf("Ҫ޸ѧѧţ\n"); + gets(_id); + for(i=0;i<15;i++) +{ + if(strcmp(_id,student[i].id)==0) +{ + printf("ѡҪ޸ĵݣ1 2༶ 3ϻʱ 4»ʱ\n"); + scanf("%d",&n); + switch(n) + { + case 1: + printf("µ:\n"); + getchar(); + gets(name); + strcpy(student[i].name,name); + system("pause"); + break; + + case 2: + printf("µİ༶:\n"); + getchar(); + gets(banji); + strcpy(student[i]._class,banji); + system("pause"); + break; + + case 3: + printf("µϻʱ:\n"); + getchar(); + scanf("%d:%d",&bh,&bm); + student[i].begin_hour=bh;student[i].begin_min=bm; + system("pause"); + break; + + case 4: + printf("µ»ʱ:\n"); + getchar(); + scanf("%d:%d",&eh,&em); + student[i].end_hour=eh; + student[i].end_min=em; + student[i]._fee=(student[i].end_hour+student[i].end_min/60-student[i].begin_hour-student[i].end_min/60)*5; + system("pause"); + break; + } +} +} +} diff --git a/机房收费管理系统最初模型(主菜单).exe b/机房收费管理系统最初模型(主菜单).exe new file mode 100644 index 0000000..ebecd73 Binary files /dev/null and b/机房收费管理系统最初模型(主菜单).exe differ diff --git a/机房收费管理系统粗糙版.cpp b/机房收费管理系统粗糙版.cpp new file mode 100644 index 0000000..a5787ac --- /dev/null +++ b/机房收费管理系统粗糙版.cpp @@ -0,0 +1,248 @@ +#include +#include +#include + +struct +{ + char id[20]; + char name[20]; + char _class[5]; + char online[1]; + float _fee; + float begin_hour; + float begin_min; + float end_hour; + float end_min; +}student[15]; + +void dengji(); +void shangji(); +void fee(); +void xiugai(); +void chaxun(); + +int i,k,m; + +int main(void) +{ + int select; + do + { + printf("*****************ӭշѹϵͳ*****************\n"); + printf(" 1.ѧǼ\n"); + printf(" 2.ѧϻʱ\n"); + printf(" 3.ѧ»ʱ估\n"); + printf(" 4.޸ѧϢ\n"); + printf(" 5.ѯѧϢ\n"); + printf(" 6.˳ϵͳ\n"); + printf("*****************ӭշѹϵͳ*****************\n"); + printf(" ѡ:"); + scanf("%d",&select); +switch(select) +{ +case 1: getchar(); + dengji(); + break; + +case 2: getchar(); + shangji(); + break; + +case 3:getchar(); + fee(); + break; + +case 4:getchar(); + xiugai(); + break; + +case 5:getchar(); + chaxun(); + break; + +case 6: break; + +default:break; +} +system("cls"); +}while(select!=6); + +return 0; + +} + +void dengji() //ѧϢ// +{ + static int j=0; + system("cls"); + printf("****************ѧϢǼ****************\n"); + for(i=j;i<15;i++) + { + char c; + printf("༶:"); + gets(student[i]._class); + printf("ѧ:"); + gets(student[i].id); + printf(":"); + gets(student[i].name); + printf("Ƿ룿(YN)"); + scanf("%c",&c); + if(c=='N'||c=='n') + { + j=i+1; + break; + } + getchar(); + printf("\n"); + } +} + +void shangji() //ϻ// +{ + char _id[20]; + system("cls"); + printf("****************ϻʱǼ****************\n"); + printf("ϻѧѧ:"); + gets(_id); + for(i=0;i<15;i++) +{ + if(strcmp(_id,student[i].id)==0) + { + printf("ϻʱ:"); + scanf("%f:%f",&student[i].begin_hour,&student[i].begin_min); + printf("һ........\n"); + system("pause"); + break; + } +} + if(i==14) + { + printf(" Ϣδ¼!\n"); + printf(" һ........\n"); + system("pause"); + + } + +} + +void fee() //»// +{ + char _id[20]; + system("cls"); + printf("****************»ʱ估õǼ****************\n"); + printf("ÿСʱ5Ԫ\n"); + printf("»ѧѧ:"); + gets(_id); + for(i=0;i<15;i++) +{ + if(strcmp(_id,student[i].id)==0) + { + if(!(student[i].begin_hour&&student[i].begin_min)) + { + printf("δϻ!\n"); + system("pause"); + break; + } + printf("»ʱ:"); + scanf("%f:%f",&student[i].end_hour,&student[i].end_min); + student[i]._fee=(student[i].end_hour+student[i].end_min/60-student[i].begin_hour-student[i].end_min/60)*5; + printf("Ϊ:%.1f\n",student[i]._fee); + printf("һ........\n"); + system("pause"); + break; + } +} + if(i==14) + { + printf(" Ϣδ¼!\n"); + printf(" һ........\n"); + system("pause"); + } + +} + +void chaxun() //ѯ// +{ + system("cls"); + printf("*************************************ѧϢѯ*************************************\n"); + printf("༶\t\t"); + printf("ѧ\t\t"); + printf("\t\t"); + printf("ϻʱ\t"); + printf("»ʱ\t"); + printf("ϻ\t"); + printf("״̬\n"); + for(i=0;i<15;i++) + { + printf("%s\t\t",student[i]._class); + printf("%s\t\t",student[i].id); + printf("%s\t\t",student[i].name); + printf("%g:%g\t\t",student[i].begin_hour,student[i].begin_min); + printf("%g:%g\t\t",student[i].end_hour,student[i].end_min); + printf("%.1f\t\t",student[i]._fee); + if(student[i].begin_hour==0) + printf("δϻ"); + else if(student[i].begin_hour!=0&&student[i].end_hour==0) + printf(""); + else if(student[i].begin_hour!=0&&student[i].end_hour!=0) + printf(""); + printf("\n"); + } + printf("*************************************ѧϢѯ*************************************\n"); + printf("\n\nһ"); + getchar(); +} + +void xiugai() //޸// +{ + char _id[20],name[20],banji[5]; + int eh,em,n,bh,bm; + system("cls"); + printf("****************޸ѧϢ****************\n"); + printf("Ҫ޸ѧѧţ\n"); + gets(_id); + for(i=0;i<15;i++) +{ + if(strcmp(_id,student[i].id)==0) +{ + printf("ѡҪ޸ĵݣ1 2༶ 3ϻʱ 4»ʱ\n"); + scanf("%d",&n); + switch(n) + { + case 1: + printf("µ:\n"); + getchar(); + gets(name); + strcpy(student[i].name,name); + system("pause"); + break; + + case 2: + printf("µİ༶:\n"); + getchar(); + gets(banji); + strcpy(student[i]._class,banji); + system("pause"); + break; + + case 3: + printf("µϻʱ:\n"); + getchar(); + scanf("%d:%d",&bh,&bm); + student[i].begin_hour=bh;student[i].begin_min=bm; + system("pause"); + break; + + case 4: + printf("µ»ʱ:\n"); + getchar(); + scanf("%d:%d",&eh,&em); + student[i].end_hour=eh; + student[i].end_min=em; + student[i]._fee=(student[i].end_hour+student[i].end_min/60-student[i].begin_hour-student[i].end_min/60)*5; + system("pause"); + break; + } +} +} +}