当前位置:文档之家› 机房收费管理系统

机房收费管理系统

机房收费管理系统The document was prepared on January 2, 2021目录第一章课程设计任务内容题目:机房收费管理系统目前,在部分高校中,计算机机房的上机收费仍然采用传统的人工计时方式,即学生凭有效证件前来上机,由机房管理人员手工登记开始时间和结束时间,然后按实际机时进行计算并收取相应费用。

人工计时计费方式不但效率低,而且容易出错,也不利于定期的统计工作。

随着高校学生人数的不断增加,这些工作的难度和强度也不断加大,给机房管理部门带来了很大的压力。

本课程设计要求实现机房收费管理系统,具体任务如下:(1)输入功能:输入30名学生的学号、班级、姓名、上机起始时间。

(2)计算功能:计算每个下机学生的上机费用,每小时1元。

(上机费用=上机时间* h ,不足一小时按一小时计算)(3)查询功能:按条件(班级、学号、姓名)显示学生的上机时间。

(4)机器使用情况的显示(显示方式不限但要一目了然)。

第二章详细课程设计系统总体模块图系统的整体模块描述如图所示图3-1 系统总体模块图系统的功能模块划分每一条记录包含一个学生学号、学生班级、学生姓名、上机起始时间,同时包含:完成对学生上机时间的录入;按条件(班级、学号、姓名)显示学生的上机时间,计算每个下机学生的上机费用,并能根据学生的上机时间进行计算上机费用,而且还能显示机器使用情况。

主要函数介绍Main-menu函数:输出机房管理系统菜单Input函数:输入若干学生的学号、班级和姓名及上机时间Online函数:学生上机,输入上机学生学号或姓名及时间Calculator函数:计算上机费用并输出Offline函数:学生下机时间,调用calculator函数得到上机费用Search函数:查找学生上机信息Display函数:显示全部机器的使用信息Main函数:函数调用以及结束程序系统程序代码及注释输入功能:输入30名学生的学号、班级、姓名、上机起始时间#include<>#include<>#include<>#include<>#define N 20#define M 100struct student{ char id[N];char theclass[N];char name[N];char ontime[N];}student[M];int n;void addition(){ int i;printf("\n请输入录入学生信息的总数:");scanf("%d",&n);for(i=1;i<=n;i++){ printf("\n\t请输入第%d个学生学号(20s):",i);scanf("%s",student[i-1].id);printf("\n\t请输入第%d个学生班级(20s):",i);scanf("%s",student[i-1].theclass);printf("\n\t请输入第%d个学生姓名(20s):",i);scanf("%s",student[i-1].name);printf("\n\t请输入第%d个学生上机时间(20s)(例:02):",i); scanf("%s",student[i-1].ontime);printf("\n\t提示:您已成功录入第%d条信息\n",i);}}计算功能:计算每个下机学生的上机费用,每小时1元。

(上机费用=上机时间* h ,不足一小时按一小时计算)void calculate(){ int hours;char times[30];time_t rawtime;struct tm * timeinfo;time ( &rawtime );timeinfo = localtime(&rawtime );strcpy(times,asctime(timeinfo));printf("\t所有学生上机费用如下:\n");for(int i=1;i<=n;i++){printf("学生%d费用:",i); if((student[i-1].ontime[3]-48)*10+student[i-1].ontime[4]>(times[14]-48)*10+times[15])hours=(times[11]-48)*10+times[12]-(student[i-1].ontime[0]-48)*10-student[i-1].ontime[1];else hours=(times[11]-48)*10+times[12]-(student[i-1].ontime[0]-48)*10-student[i-1].ontime[1]+1;printf("%d\n",hours);}}void calculate(){ int hours;char times[30];time_t rawtime;struct tm * timeinfo;time ( &rawtime );timeinfo = localtime(&rawtime );strcpy(times,asctime(timeinfo));printf("\t所有学生上机费用如下:\n");for(int i=1;i<=n;i++){ printf("学生%d费用:",i); if((student[i-1].ontime[3]-48)*10+student[i-1].ontime[4]>(times[14]-48)*10+times[15])hours=(times[11]-48)*10+times[12]-(student[i-1].ontime[0]-48)*10-student[i-1].ontime[1];else hours=(times[11]-48)*10+times[12]-(student[i-1].ontime[0]-48)*10-student[i-1].ontime[1]+1;printf("%d\n",hours);}}查询功能:按条件(班级、学号、姓名)显示学生的上机时间。

void search(){ int i,b,c,count;do{ char find[20];printf("\n请选择查询方式:1.根据学号查询;2.根据班级查询;3.根据姓名查询;4.根据上机时间:");scanf("%d",&b);switch(b){ case 1: count=PF_FLOATING_POINT_PRECISION_ERRATA; printf("\n**请输入学生的学号:");scanf("%s",find);for(i=0;i<n;i++){ if (strcmp(student[i].id,find)==0){ count++;if(count==PF_FLOATING_POINT_EMULATED)printf("学生学号\t学生班级\t学生姓名\t上机时间\n");printf("%8s%15s%15s%17s",student[i].id,student[i].theclass,student[i].name,student[i].ontime);}}if(!count)printf("****提示:该生不存在");goto A;case 2: count=PF_FLOATING_POINT_PRECISION_ERRATA;printf("\n**请输入学生的班级:");scanf("%s",find);for(i=0;i<n;i++){ if (strcmp(student[i].theclass,find)==0){ count++;if(count==PF_FLOATING_POINT_EMULATED)printf("学生学号\t学生班级\t学生姓名\t上机时间\n");printf("%8s%15s%15s%17s",student[i].id,student[i].theclass,student[i].name,student[i].ontime);}}if(!count)printf("****提示:该生不存在");goto A;case 3: count=PF_FLOATING_POINT_PRECISION_ERRATA;printf("\n**请输入学生的姓名:");scanf("%s",find);for(i=0;i<n;i++){if (strcmp(student[i].name,find)==0){count++;if(count==PF_FLOATING_POINT_EMULATED)printf("学生学号\t学生班级\t学生姓名\t上机时间\n");printf("%8s%15s%15s%17s",student[i].id,student[i].theclass,student[i].name,student[i].ontime);}}if(!count) printf("****提示:该生不存在");goto A;case 4: count=PF_FLOATING_POINT_PRECISION_ERRATA;printf("\n**请输入学生的上机时间:");scanf("%s",find);for(i=0;i<n;i++){ if (strcmp(student[i].ontime,find)==0){ count++;if(count==PF_FLOATING_POINT_EMULATED)printf("学生学号\t学生班级\t学生姓名\t上机时间\n");printf("%8s%15s%15s%17s",student[i].id,student[i].theclass,student[i].name,student[i].ontime);}}if(!count)printf("****提示:该生不存在");goto A;default:printf("*****提示:输入错误");}A:printf("\n\t**1.继续\n\t**0.返回主菜单");printf("\n\t 请输入您的选择:");scanf("%d",&c);}while(c);}机器使用情况的显示(显示方式不限但要一目了然)void menu(){printf("\n\t*******************欢迎进入机房收费管理系统!*******************\n");printf("\t* 1.录入功能2.计算功能*\n");printf("\t* 3.查询功能*EXIT*- *\n");printf("\t*********************************************************** ****\n");printf("\n\t 请输入您的选择:");}void main(){ system("color 5f");int a;C:menu();scanf("%d",&a);switch(a){case 0:printf("***正在退出**谢谢使用本系统,再见");break;case 1:addition();goto C;/*录入功能*/case 2:calculate();goto C; /*浏览功能*/case 3:search();goto C; /*查询功能*/ }}第三章软件使用说明录入系统图3-1 输入30名学生的学号、班级、姓名、上机起始时间计算功能图3-2计算每个下机学生的上机费用查询功能图3-3 按条件(班级、学号、姓名)显示学生的上机时间机器使用情况图3-4 机器使用情况查询第四章课程设计心得与体会在这次课程设计中,我体会颇多,学到很多东西。

相关主题