




已阅读5页,还剩16页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
#include#include#include#include #include#includeusing namespace std;int s=0;int u=0;class teacher;class studentpublic:void resetsno(int);void inputst(char * ,char *,int,int,char *,long);void outputst(int);int checkst(int);void findst(int);void deletest(int); void resortst(int);void coverst(int);int getsno(int);void lessoninput(int);int outtofile1(int);student student:operator=(student &s1);double value(teacher &te);protected:char name20;char sex20;int age;int sno;long tel;char banji50;char lesson1050;/用二维的字符数组存储学生所学的课程;class teacherpublic:double resetscore(double,int);teacher teacher:operator=(teacher &t1);void resetworkno(int);void inputte(char *,char *,int,char *,char *,int);void outputte(int);int checkte(int);void findte(int);void deletete(int); void resortte(int);void resort(int);void coverte(int);int getworkno(int);int outtofile2(int);double getscore(int);friend double student:value(teacher &te);/友元成员。声明类student的value作为类teacher的友元函数。protected:char name20;char sex20;int age;int workno;char les50;char dep50;double score;student stu50;teacher tea10;int student:getsno(int s)return stus.sno; void student:resetsno(int s)cinstus.sno;student student:operator=(student &s1)/用成员函数来实现赋值运算符的重载。strcpy(name,);sno=s1.sno;strcpy(banji,s1.banji);strcpy(sex,s1.sex);age=s1.age;tel=s1.tel;for(int i=0;i10;i+)strcpy(lessoni,s1.lessoni);return *this;void student:inputst(char *xm ,char *xb,int nl,int xh,char *bj,long dh)strcpy(,xm);strcpy(stus.sex,xb);stus.age=nl;while (xh999) /判断输入的学号是否正确 cout您输入的学号不正确,请输入一个三位数的学号xh;while(checkst(xh)cout学号重复!请重新输入:xh;stus.sno=xh; strcpy(stus.banji,bj);stus.tel=dh;void student:lessoninput(int s)int n;coutn;for(int i=0;in;i+)cout这是本学期第i+1stus.lessoni;void student:outputst(int s)cout学生的姓名是:endl;cout学生的性别是:stus.sexendl;cout学生的学号是:stus.snoendl;cout学生的年龄是:stus.ageendl;cout学生的班级是:stus.banjiendl;cout学生的联系电话是:stus.telendl;cout学生本学期所学课程有:;for(int i=0;i10;i+)couttteau.workno; int teacher:getworkno(int u)return teau.workno;void teacher:inputte(char *xm,char *xb,int nl,char *yb,char *kc,int gh)strcpy(,xm);strcpy(teau.sex,xb);teau.age=nl;while (gh99999) /判断输入的学号是否正确 cout您输入的工号不正确,请输入一个五位数的工号gh;while(checkte(gh)cout工号重复!请重新输入:gh;teau.workno=gh; strcpy(teau.dep,yb);strcpy(teau.les,kc);void teacher:outputte(int u)cout教师的姓名是:endl;cout教师的性别是:teau.sexendl;cout教师的年龄是:teau.ageendl;cout教师的工号是:teau.worknoendl;cout教师的院部是:teau.dependl;cout教师所教授的课程是:teau.lesendl;double student:value(teacher &te)int n=0;double sum=0;for(int i=1;i=s;i+)int m=0;for(int j=0;j10;j+)if(strcmp(stui.lessonj,te.les)=0)/只有当学生学习了教师教授的课程才可以对教师进行评教 n+;m+;同学:;coutte.score;sum+=te.score;if(m=0)同学:;cout你没有学习该教师的课程!不能对其进行评分。endl;if(n=0)cout没有学生对该教师进行评分。endl;return 0;elsecout有n个学生对该教师进行了评分。endl;return sum/n;int student:checkst(int xh1)/检查 int m=0; while(ms+1) return 0; else return 1; int student:outtofile1(int s)ofstream fout(D:student.txt,ios:app);if(!fout)cout文件打开失败!endl;return 1; stus.sex stus.age stus.sno stus.banji stus.tel ;for(int i=0;i10;i+)foutstus.lessoni ;fout.close();return 0;void student:findst(int s) /按学号查找模块 int xh,p; while(s=0) cout没有记录,请先输入记录!endl; break; if(s!=0) coutxh; while (xh999) cout您输入的学号不正确,请您输入一个三位数的学号xh; while(checkst(xh)cout学号重复!请重新输入:xh;while(s!=0) /查找是否有符合条件的记录 if (xh=stus.sno) p=1;outputst(s);coutendl;getch(); break; else p=0; s-; if(p=0) /用p标记是否有查找的对象。cout很抱歉,没有找到您要查找的学号!endl;getch(); void student:resortst(int s) /按学号排序 student st1; while(s=0) cout没有记录,请先输入记录!endl; break; if(s!=0) for(int i=1;i=s;i+) /利用冒泡法对stu进行排序 for(int j=1;jstuj+1.sno) st1=stuj; stuj=stuj+1; stuj+1=st1; for(int k=1;k=s;k+)outputst(k);coutendl; getch(); void student:deletest(int n) /删除学生记录 int xh,p=0; char da; while(s=0) cout没有学生记录,请先输入记录!endl; break; if(s!=0) coutxh; while (xh999) cout您输入的学号不正确,请您输入一个三位数的学号xh; while(checkst(xh)cout学号重复!请重新输入:xh;for(int i=1;i=n;i+) if(stui.sno=xh) outputst(i);coutendl;coutda; if(da=y|da=Y) for(int j=i;jn;j+) /删除记录 strcpy(,stuj+1.name); strcpy(stuj.sex,stuj+1.sex);stuj.age=stuj+1.age;stuj.sno=stuj+1.sno; strcpy(stuj.banji,stuj+1.banji);stuj.tel=stuj+1.tel;for(int k=0;k10;k+)strcpy(stuj.lessonk,stuj+1.lessonk); cout该记录已删除!endl; s=s-1; p=1; break; else cout该记录未删除!endl; p=1; if(p=0) cout很抱歉,没有找到您要找的学号!endl; getch(); void student:coverst(int s)/为检查修改的结果应该把修改前和修改后的结果都输出来。/不允许修改学号int p,xh;while(s=0) cout没有学生记录,请先输入记录!endl; break; if(s!=0)cout请输入要修改的学生的学号:xh;while (xh999) cout您输入的学号不正确,请您输入一个三位数的学号xh; while(checkst(xh)cout学号重复!请重新输入:xh;for(int i=1;i=s;i+) if(stui.sno!=xh) p=0; if(stui.sno=xh)p=1;cout修改前的学生信息是:endl;outputst(i);coutendl;cout请输入学生的以下信息:endl; ;coutstui.sex;coutstui.age;coutstui.banji;coutstui.tel;cout课程:;lessoninput(i);coutendl;cout修改后的学生信息是:endl;outputst(i);coutendl;break;if(p=0) cout很抱歉,没有找到您要找的学号!endl; getch(); /teacher teacher:operator=(teacher &t1)/用成员函数来实现赋值运算符的重载。strcpy(name,);workno=t1.workno;strcpy(sex,t1.sex);strcpy(dep,t1.dep);age=t1.age;score=t1.score;strcpy(les,t1.les);return *this;int teacher:checkte(int gh1)/检查模块 int n=0; while(nu+1) return 0; else return 1; void teacher:findte(int u) /按工号查找模块 int gh,p; while(u=0) cout没有教师记录,请先输入记录!endl; break; if(u!=0) coutgh; while (gh99999) /判断输入的工号是否正确 cout您输入的工号不正确,请输入一个五位数的工号gh;while(checkte(gh)cout工号重复!请重新输入:gh;while(u!=0) /查找是否有符合条件的记录 if (gh=teau.workno) p=1;outputte(u);coutendl;getch(); break; else p=0; u-; if(p=0) /用p标记是否有查找的对象。cout很抱歉,没有找到您要查找的工号!endl;getch(); void teacher:resortte(int u) /按工号排序 teacher te; while(u=0) cout没有教师记录,请先输入记录!endl; break; if(u!=0) for(int i=1;i=u;i+) /利用冒泡法对tea进行排序 for(int j=1;jteaj+1.workno) te=teaj; teaj=teaj+1; teaj+1=te; for(int k=1;k=u;k+)outputte(k);coutendl; getch(); int teacher:outtofile2(int u)ofstream fout1(D:teacher.txt,ios:app);if(!fout1)cout文件打开失败!endl;return 1; teau.sex teau.age teau.workno teau.dep teau.les teau.score;fout1.close();return 0;double teacher:resetscore(double cj,int u)teau.score=cj;return teau.score;void teacher:resort(int u) /按评教成绩对教师进行排序 teacher te; cout请在进行此功能前首先确定已经进行过评教!endl;while(u=0) cout没有教师记录,请先输入记录!endl; break; if(u!=0) for(int i=1;i=u;i+)for(int j=1;j=u-i;j+) if(teaj.scoreteaj+1.score) te=teaj; teaj=teaj+1; teaj+1=te; for(int k=1;k=u;k+)te.outputte(k);cout该教师的评教成绩是:teak.getscore(k)endl;coutendl; getch(); void teacher:deletete(int n) /删除教师记录 int gh,p=0; char da; while(u=0) cout没有教师记录,请先输入记录!endl; break; if(u!=0) coutgh; while (gh99999) /判断输入的工号是否正确 cout您输入的工号不正确,请输入一个五位数的工号gh;while(checkte(gh)cout工号重复!请重新输入:gh;for(int i=1;i=n;i+) if(teai.workno=gh) outputte(i);coutendl;coutda; if(da=y|da=Y) for(int j=i;jn;j+) /删除记录 strcpy(,teaj+1.name); strcpy(teaj.sex,teaj+1.sex);teaj.age=teaj+1.age;teaj.workno=teaj+1.workno; strcpy(teaj.dep,teaj+1.dep);strcpy(teaj.les,teaj+1.les); cout该记录已删除!endl; u=u-1; p=1; break; else cout该记录未删除!endl; p=1; if(p=0) cout很抱歉,没有找到您要找的工号!endl; getch(); void teacher:coverte(int u)/为检查修改的结果应该把修改前和修改后的结果都输出来。/不允许修改工号int p,gh;while(u=0) cout没有记录,请先输入记录!endl; break; if(u!=0)cout请输入要修改的教师的工号:gh;while (gh99999) /判断输入的工号是否正确 cout您输入的工号不正确,请输入一个五位数的工号gh;while(checkte(gh)cout工号重复!请重新输入:gh;for(int i=1;i=u;i+) if(teai.workno!=gh) p=0; if(teai.workno=gh)p=1;cout修改前的教师信息是:endl;outputte(i);coutendl;cout请输入教师的以下信息:endl; ;coutteai.sex;coutteai.age;coutteai.dep;coutteai.les;coutendl;cout修改后的教师信息是:endl;outputte(i);coutendl;break;if(p=0) cout很抱歉,没有找到您要找的工号!endl; getch(); void main()student st; char da,*xm,*xb,*bj,*yb,*kc; int a,nl,xh,gh;long dh;teacher te;double cj;time_t t; time(&t); while(1) system(cls); coutendl; cout欢迎使用学生评教管理系统endl; cout 时间和日期:ctime(&t)endl; cout1输入/添加学生资料endl; cout2显示学生资料endl; cout3按学号查找学生资料endl;cout4按学生学号排序endl;cout5按学号修改学生资料endl;cout6按学号删除学生资料endl;cout7输入/添加教师资料endl;cout8对教师进行评教endl;cout9显示教师资料endl;cout10按教师工号查找教师信息endl;cout11按教师评教成绩平均分进行排序endl; cout12按教师工号排序endl;cout13按教师工号修改教师资料endl;cout14按教师工号删除教师资料endl;cout0退出endl; cout 请选择操作(1-14)endla; exit: if(a=0) break; /exit是标号。switch(a)case 1: xm=new char;xb=new char;bj=new char;cout请输入学生的以下信息:endl; coutxm;coutxb;coutnl;coutxh;coutbj;coutdh;while(st.checkst(xh) cout学号重复,请重新输入!xh; s=s+1; st.inputst(xm,xb,nl,xh,bj,dh); st.lessoninput(s); coutda; while (da=y|da=Y) /判断是否要继续输入 xm=new char;xb=new char;bj=new char;cout请输入学生的以下信息:endl; coutxm;coutxb;coutnl;coutxh;coutbj;coutdh;while(st.checkst(xh) cout学号重复,请重新输入!xh; s=s+1; st.inputst(xm,xb,nl,xh,bj,dh); st.lessoninput(s);coutda; getch(); ;break; case 2: if(s=0) /判断是否有记录输入 cout没有学生记录,请先输入记录!endl; getch(); break; if(s!=0) for(int i=1;i=s;i+) st.outputst(i);st.outtofile1(i);coutendl;getch(); ;break; case 3:st.findst(s);break;case 4:st.resortst(s
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 淡水养殖废弃物艺术创作利用创新创业项目商业计划书
- 水果低卡食品创新创业项目商业计划书
- 搜索引擎营销(SEM)智能管理平台创新创业项目商业计划书
- 期货从业证考试要点及答案解析
- 护理三基知识考试题库及答案解析
- 山东省临沭县第三初级中学七年级信息技术下册《第三单元 第4课 图像处理(三)-与圣人同行》说课稿
- 2025年电解镍行业研究报告及未来行业发展趋势预测
- 2025年醋酸氢化可的松行业研究报告及未来行业发展趋势预测
- 2025年车轮行业研究报告及未来行业发展趋势预测
- 2025年车用空气悬架行业研究报告及未来行业发展趋势预测
- 非盗抢汽车合同协议
- 爱国卫生运动主题班会课件
- 染织工艺知识培训课件
- 全屋定制家具安装规范
- 公路应急抢修合同标准文本
- 教师在线教学能力提升学习总结
- 交通安全培训(摩托车电动车)
- 玉盘二部合唱简谱
- 医院培训课件:《胰岛素规范化注射》
- 木材加工质量控制与验收考核试卷
- 《布病防控知识》课件
评论
0/150
提交评论