学生考勤管理系统源代码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

#includeiostream#includecstring#includewindows.husingnamespacestd;classtime{public:time(inty=0,intm=0,intd=0){year=y;month=m;day=d;}~time(){}protected:intyear,month,day;};//信息类classxinxi:publictime{public:xinxi(){tiaoshu++;}~xinxi(){tiaoshu--;}voidsetname(char*n){strcpy(name,n);}voidsettime(inty,intm,intd){year=y;month=m;day=d;}voidsetqklx(char*qk){strcpy(queke,qk);}voidsetjieci(char*jc){strcpy(jieci,jc);}voidsetkechen(char*kc){strcpy(kechen,kc);}char*getname(){char*n;n=name;returnn;}char*getqklx(){char*qk=queke;returnqk;}char*getjieci(){char*jc;jc=jieci;returnjc;}char*getkechen(){char*gk;gk=kechen;returngk;}int*gettime();private:charname[20];//姓名charjieci[3],kechen[10],queke[10];inttm[3];staticinttiaoshu;};intxinxi::tiaoshu=0;int*xinxi::gettime(){int*t;t=tm;tm[0]=year;tm[1]=month;tm[2]=day;returnt;}classqkechen:publicxinxi{public:qkechen(){kcshu++;}~qkechen(){kcshu--;}intgetrc(xinxist1[],intn,intj);charqkn[20];//公有数据成员private:intrenci;staticintkcshu;//静态数据成员};intqkechen::kcshu=0;intqkechen::getrc(xinxist1[],intn,intj){renci=0;renci++;for(inti=0;in;i++)if(*(st1[i+1].gettime()+1)==*(st1[j].gettime()+1)&&*(st1[i+1].gettime()+2)==*(st1[j].gettime()+2))if(strcmp(qkn,st1[i].getkechen())==0)renci++;returnrenci;}classqstu:publicxinxi{public:qstu(){qst++;}~qstu(){qst--;}voidprint(xinxi&st1);intgetjs(xinxist1[],intn,intj);intsetjs(intjs=0){jieshu=js;}charqstn[20];private:intjieshu;staticintqst;//静态数据成员};intqstu::qst=0;voidqstu::print(xinxi&st1){cout|缺课日期|第几节课|课程名称|缺课类型|endl;cout|*st1.gettime()|*(st1.gettime()+1)*(st1.gettime()+2)|st1.getjieci()|st1.getkechen()|st1.getqklx()|endl;}intqstu::getjs(xinxist1[],intn,intj){inti=0,js=0;xinximin;if(*(st1[j].getjieci()+2)!='\0')js=+2;elsejs++;for(i=0;in;i++)if(*(st1[i+1].gettime()+1)==*(st1[j].gettime()+1)&&*(st1[i+1].gettime()+2)==*(st1[j].gettime()+2))if(strcmp(st1[i+1].getname(),qstn)==0){if(*(st1[i].getjieci()+2)!='\0')js=+2;elsejs++;}jieshu=js;returnjieshu;}//函数声明intshuru(xinxist1[]);voidchaxun(xinxist1[],qstuqt[]);voidxiugai(xinxist1[],intn);voidtongji1(xinxist1[],qstuqt1[]);voidtongji2(xinxist1[],qkechenqk1[]);voidcaidan();voidxiansi(xinxi&st1);voidsetqstn(xinxist1[],qstuqt1[],intn);voidsetqkn(xinxist1[],qkechenqk[],intn);//全局变量intg,k=1,b=1;intq=-1;charname[20],kechen[10],queke[10],jieci[3];inty,m,d;//主函数intmain(){xinxitl[15];//定义15条信息类对象qstuqt[10];qkechenqk[6];intch;while(1){cout********欢迎进入学生考勤管理系统!*********endl;caidan();cout--------请选择菜单项:endl;cinch;switch(ch){case1:g=shuru(tl);break;case2:xiugai(tl,g);break;case3:chaxun(tl,qt);break;case4:tongji1(tl,qt);break;case5:tongji2(tl,qk);break;case6:exit(0);}}return0;}voidcaidan(){system(colorA);cout*************************************************************endl;cout*学生考勤管理系统*endl;cout*************************************************************endl;cout1.-------------录入学生的缺课记录---------------------------*endl;cout2.-------------修改学生的缺课记录---------------------------*endl;cout3.-------------查询学生的缺课情况---------------------------*endl;cout4.--------统计某段时间内旷课学生姓名及旷课节数--------------*endl;cout5.--------统计某段时间内旷课的课程及旷课人次----------------*endl;cout6.----------------退出系统----------------------------------*endl;}//输入函数intshuru(xinxist1[]){chara;cout------输入开始!----endl;do{q++;cout请输入学生姓名endl;cinname;st1[q].setname(name);cout请输入课程名称endl;cinkechen;st1[q].setkechen(kechen);cout请输入缺课日期endl;cinymd;st1[q].settime(y,m,d);cout请输入缺课类型endl;cinqueke;st1[q].setqklx(queke);cout请输入缺课节次endl;cinjieci;st1[q].setjieci(jieci);cout是否还要继续输入:(y/n)endl;cina;}while(a=='y');returnq+1;}voidxiugai(xinxist1[],intn){intk=1,j=0,a[10];intflgh;inth;while(k==1){cout请输入你要修改缺课记录的学生姓名endl;cinname;flgh=0;for(inti=0;in;i++)if(strcmp(name,st1[i].getname())==0)do{a[j]=i;cout1.修改日期2.修改节次3.修改课程名称4.修改缺课类型endl;cout请输入要选择的数值(1,2,3,4)endl;intb;cinb;if(b==1){cout请输入新日期endl;cinymd;st1[i].settime(y,m,d);}elseif(b==2){cout请输入新节次endl;cinjieci;st1[i].setjieci(jieci);}elseif(b==3){cout请输入新课程名称endl;cinkechen;st1[i].setkechen(kechen);}elseif(b==4){cout请输入新缺课类型endl;cinqueke;st1[i].setqklx(queke);}flgh=1;j++;}while(b1||b4);if(flgh==0){cout没有你要找的学生姓名,请重试要退出请按0endl;cink;}else{cout还要继续吗(1\0)退出请按0endl;cink;}}for(inti=0;ij;i++){h=a[i];xiansi(st1[h]);}}voidchaxun(xinxist1[],qstuqt[]){charn='y';intu[10];while(n=='y'){intj=0;cout输入你要查询的学生姓名:endl;cinname;inti=0;for(;ig;i++)if(strcmp(name,st1[i].getname())==0){u[j]=i;j++;}if(j==0){cout没有你所要的学生名字!;//没有找到cout是否退出退出请按n\n;cinn;}for(inta=0;aj;a++){//只有一条信息if(j2){i=u[a];cout|缺课日期|第几节课|课程名称|缺课类型|endl;cout|*st1[i].gettime()|*(st1[i].gettime()+1)|*(st1[i].gettime()+2)|st1[i].getjieci()|st1[i].getkechen()|st1[i].getqklx()|endl;}//两条信息以上排序else{i=u[a];if(*(st1[i].gettime()+1)*(st1[i+1].gettime()+1))qt[i].print(st1[i]);elseif(*(st1[i].gettime()+1)==*(st1[i+1].gettime()+1)&&*(st1[i].gettime()+2)*(st1[i+1].gettime()+2))qt[

1 / 10
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功