#include <stdio.h>
#include <time.h>#include <math.h>#define C 60000;struct Student{ char name[20]; int num; char banji[10]; int time; int feiyong; }; void menu() { printf("\t\t\t*******************\n"); printf("\t\t\t\t1、输入 ******** \n"); printf("\t\t\t\t2、查询 *********\n "); printf("\t\t\t\t3、使用显示****** \n"); printf("\t\t\t\t4、退出 *********** \n "); printf("\t\t\t*******************\n"); } int main() { clock_t start,finish; double TheTimes; struct Student stu[30] ; int i,j,d,e,f;char na[20]; printf("\t\t\t\t***** 欢迎进入机房收费管理系统 ****\n ") ; while(1) { menu(); printf("\t请输入你的选择:"); scanf("%d",&i) ; switch(i) { case 1: for(int i=0;i<30;i++) { printf("请输入学号:"); scanf("%d",&stu[i].num); printf("\n 请输入班级:"); scanf("%s",stu[i].banji); printf("\n请输入姓名:"); scanf("%s",stu[i].name); printf("\n请输入上机时间:"); scanf("%d",&stu[i].time); stu[i].feiyong=0; } start=clock() ;break; case 2: printf(" 1、按学号查询:"); printf("\n2、按姓名查询:\n"); scanf("%d",&e); if(e==1) { printf(" 请输入要查询的学号:"); scanf("%d",&d); for(j=0;j<30;j++) { if( stu[j].num==d) { finish=clock(); TheTimes=(double)(finish-start)/C; printf("你上来%f分钟\n",TheTimes); } } } else if(e==2) { printf(" 请输入要查询的姓名:"); scanf("%s",na); for(j=0;j<30;j++) { if( stu[j].name==na) { finish=clock(); TheTimes=(double)(finish-start)/C; printf("你上来%f分钟\n",TheTimes); } } } ; break; case 3: for(j=0;j<30;j++) { finish=clock(); TheTimes=(double)(finish-start)/C; stu[j].feiyong=(TheTimes/60)*1; } for(j=0;j<30;j++) { printf("学号:%d",&stu[j].num); printf("\n 班级:%s",stu[j].banji); printf("\n姓名:%s",stu[j].name); printf("\n上机时间:%d",&stu[j].time); printf("\n费用:%d",&stu[j].feiyong); printf("\n请输入上机时间:%d",&stu[j].time); printf("\n"); } ;break; case 4:return 0;break; } } return 0; }