commit 11edb3a192f544787bbb79ef4f501a54a6a34bef Author: 18408000613@stu.hut.edu.cn <18408000613@stu.hut.edu.cn> Date: Thu Jan 10 09:56:12 2019 +0800 first commit diff --git a/机房收费管理系统.cpp b/机房收费管理系统.cpp new file mode 100644 index 0000000..53763dd --- /dev/null +++ b/机房收费管理系统.cpp @@ -0,0 +1,249 @@ +#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; + } +} +} +} + diff --git a/机房收费管理系统.exe b/机房收费管理系统.exe new file mode 100644 index 0000000..2c08f76 Binary files /dev/null and b/机房收费管理系统.exe differ