《机房收费管理系统C程序设计报告》由会员分享,可在线阅读,更多相关《机房收费管理系统C程序设计报告(28页珍藏版)》请在金锄头文库上搜索。
1、C+程序设计设计报告题目:机房收费管理系统一、实验题目 机房收费管理系统二、实验环境Visual C+ 6.0三、设计思想包括:函数分解过程、算法描述以及相应的数据流程图一、 函数分解过程1、输入功能struct lbtime int lbhour; int lbminute; int lbsecond; ; typedef struct char lbnum20; int lbbanji; int lbflag; char lbname20; struct lbtime lbstart,lbfinish; lbStudent; lbStudent lbstu50; struct lbcomp
2、uter int lbf; lbStudent lbstut; lbcom30; int lbk; int lbmain_menu() char lbc; do system(cls); coutttt*机房收费管理系统*nttt1.输入学生信息nttt2.上机nttt3.下机nttt4.查询上机时间nttt5.机器使用情况显示nttt0.退出系统nttt*nttt 请选择菜单(0-5):; lbc=getchar(); while(lbc5); return(lbc-0); int lbinput(lbStudent lbstu,int lbn) int lbi=0; char lbsign
3、=0; while(lbsign!=lbn&lbsign!=lbN) getchar(); couttt 学号:; gets(lbstulbn+qhi.lbnum); coutlbstulbn+lbi.lbbanji; getchar(); couttt 姓名:; gets(lbstulbn+lbi.lbname); coutlbsign; lbstulbn+qhi.lbflag=0; lbi+; return(lbn+lbi); void lbonline(lbStudent lbstu,int lbn) char lbnum_t20,lbname_t20; int lbi,lbs; do
4、coutlbs; while(lbs!=1&lbs!=2); getchar(); if(lbs=1) couttt 请输入姓名:; gets(lbname_t); for(lbi=0;lbilbn;lbi+) if(strcmp(lbstulbi.lbname,lbname_t)=0) break; else couttt 请输入学号:; gets(lbnum_t); for(lbi=0;lbilbn;lbi+) if(strcmp(lbstulbi.lbnum,lbnum_t)=0) break; if(lbi=lbn) couttt 信息库中暂无该生,请输入该生信息再上机!n; retu
5、rn; else if(lbstulbi.lbflag=1) couttt 该生正在上机!n; return; else for(lbk=0;lbk30;lbk+) if(lbcomlbk.lbf=0) lbcomlbk.lbf=1; coutlbstulbi.lbstart.lbhourlbstulbi.lbstart.lbminutelbstulbi.lbstart.lbsecond; lbstulbi.lbflag=1; lbcomlbk.lbstut=lbstulbi; break; if(lbk=30) couttt 机器全部使用中,请稍后再上机!n; 2、计算功能void lbca
6、lculate(lbStudent lbstu) int lbt; struct lbtime lbtimet; if(lbstu.lbfinish.lbsecondlbstu.lbstart.lbsecond) if(lbstu.lbfinish.lbminute=0) lbstu.lbfinish.lbhour-=1; lbstu.lbfinish.lbminute=59; else lbstu.lbfinish.lbminute-=1; lbtimet.lbsecond=lbstu.lbfinish.lbsecond+60-lbstu.lbstart.lbsecond; else lbt
7、imet.lbsecond=lbstu.lbfinish.lbsecond-lbstu.lbstart.lbsecond; if(lbstu.lbfinish.lbminutelbstu.lbstart.lbminute) lbstu.lbfinish.lbhour-=1; lbtimet.lbminute=lbstu.lbfinish.lbminute+60-lbstu.lbstart.lbminute; else lbtimet.lbminute=lbstu.lbfinish.lbminute-lbstu.lbstart.lbminute; lbtimet.lbhour=lbstu.lbf
8、inish.lbhour-lbstu.lbstart.lbhour; if(lbtimet.lbsecond=0&lbtimet.lbminute=0) lbt=lbtimet.lbhour; else lbt=lbtimet.lbhour+1; couttt 该生上机用时%d 小时,费用为%d 元n,lbt,lbt; 3、查询功能void lboffline(lbStudent lbstu,int lbn) char lbnum_t20,lbname_t20; int lbi,lbs; do coutlbs; while(lbs!=1&lbs!=2); getchar(); if(lbs=1
9、) couttt 请输入姓名:; gets(lbname_t); for(lbi=0;qhilbn;lbi+) if(strcmp(lbstulbi.lbname,lbname_t)=0) break; else couttt 请输入学号:; gets(lbnum_t); for(lbi=0;lbilbn;lbi+) if(strcmp(lbstulbi.lbnum,lbnum_t)=0) break; if(lbi=lbn) couttt 没有这个学生!n; return; else if(lbstulbi.lbflag=0) couttt 该生未上机或已下机!n; return; else
10、 coutlbstulbi.lbfinish.lbhourlbstulbi.lbfinish.lbminutelbstulbi.lbfinish.lbsecond; lbcalculate(lbstuqhi); lbstulbi.lbflag=0; for(lbk=0;lbk3;lbk+) if(strcmp(lbcomlbk.lbstut.lbnum,lbstulbi.bnum)=0) lbcomlbk.lbf=0; break; void lbsearch(lbStudent lbstu,int lbn) char lbnum_t20,lbname_t20; int lbi,lbs; do
11、 coutlbs; while(lbs!=1&qhs!=2); getchar(); if(lbs=1) couttt 请输入姓名:; gets(lbname_t); for(lbi=0;qhilbn;lbi+) if(strcmp(lbstulbi.lbname,lbname_t)=0) break; else couttt 请输入学号:; gets(lbnum_t); for(lbi=0;qhilbn;bi+) if(strcmp(lbstulbi.lbnum,lbnum_t)=0) break; if(lbi=lbn) couttt 查无此生!n; return; else if(lbs
12、tulbi.lbflag=1) couttt 该生正在上机,上机起始时间为%d:%d:%dn,lbstulbi.lbstart.lbhour,lbstulbi.lbstart.lbminute, lbstulbi.lbstart.lbsecond; else couttt 该生未上机或已下机!n; 4、机器使用情况的显示void display() coutt 机器号 是否使用 使用者 学号 班级 上机时间n; coutt-n; for(lbk=0;lbk30;lbk+) if(lbcomlbk.lbf=0) coutt%02d 否-:-:-n,qhk+1; else coutyesendl; lbcomlbk.lbstut.lbname,lbcomlbk.