




已阅读5页,还剩12页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
学生信息管理系统源代码:#include#include#include#include#include#includestruct studentchar num30; int maths; char name30; int chinese;char clas30; int english; int total; float average; student *next;/1(1)void createlist(student * & head) /学生成绩文件导入功能(用链表储存)char t80,num030,name030,clas030;int chinese0,maths0,english0;student *s,*p;ifstream instuf(student-score.txt,ios:in);if (!instuf) cerrfile could not be open.num0name0clas0chinese0maths0english0) s=new student; strcpy(s-num,num0);strcpy(s-name,name0);strcpy(s-clas,clas0); s-chinese=chinese0;s-maths=maths0;s-english=english0; s-total=s-chinese+s-maths+s-english; s-average=float(s-total)/3; if (head=NULL) head=s; else p-next=s; p=s;p-next=NULL;instuf.close();/1(2)void showlist(student *head) /学生成绩信息显示功能(遍历链表) int n=1; cout学号 姓名 班级 语文 数学 英语 总分 均分 序号 ; while (head) coutnum nametclast chineset mathstenglishttotaltsetprecision(3)averaget nnext; /2void charu(student *head) /学生成绩信息插入功能(链表尾部插入学生成绩信息) student *s,*p,*q; int n,i; coutn; cout请输入需插入的学生成绩信息(每人一行):endl; cout学号 姓名 班级 语文 数学 英语next; for (i=1;is-nums-names-class-chineses-mathss-english; s-total=s-chinese+s-maths+s-english; s-average=float(s-total)/3; q-next =s; q=s; q-next=NULL;/3void shanchu(student * & head) /学生成绩信息删除功能 student *p,*q; char a30; int n,i,b=1; coutn; cout请输入需要删除的学生的学号或姓名:endl; for (i=1;ia; if (strcmp(head-num,a)=0)|(strcmp(head-name,a)=0) b=0; p=head; head=head-next; delete p; p=NULL; else p=head; while (p-next!=NULL)&(strcmp(p-next-num,a)!=0)&(strcmp(p-next-name,a)!=0) p=p-next; if (p-next!=NULL) b=0; q=p-next; p-next=q-next; delete q; q=NULL; if (b=1) cout无此学号或姓名的成绩记录!endl;/4void change(student *head) /学生成绩信息的修改功能(修改指定学生信息) char a30; int b=1; couta; while (head) if (strcmp(head-num,a)=0)|(strcmp(head-name,a)=0) coutendl; b=0; cout此学生原来的学生成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语endl; coutnum nametclast chinesetmathstenglishendl; cout请输入修改后的学生成绩信息:endl; cout学号 姓名 班级 语文 数学 英语head-numhead-namehead-clashead-chinesehead-mathshead-english; head-total=head-chinese+head-maths+head-english; head-average=float(head-total)/3; head=head-next; if (b=1) cout无此学号或姓名的成绩记录!endl;/5(1)void geren(student *head) /查询个人成绩功能 char a30; int b=1; couta; cout此学生的学生成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语 总分 均分num,a)=0)|(strcmp(head-name,a)=0) b=0; coutnum nametclast chineset mathstenglishttotaltsetprecision(3)averagenext; if (b=1) cout无此学号或姓名的成绩记录!endl;/5(2)void chabanji(student *head) /查询班级成绩功能 char a30; int b=1; couta; cout此班级的学生成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语 总分 均分clas,a)=0) b=0; coutnum nametclast chineset mathstenglishttotaltsetprecision(3)averagenext; if (b=1) cout无此班级的成绩记录!endl;/5(3)void chayuwen(student *head) /查询语文成绩功能 int h,l,b=1; cout请输入您要查询的【语文】成绩的分数段: endl; cout起始分 终止分l; cinh; cout此分数段的学生语文成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语 总分 均分chinese=l)&(head-chinese=h) b=0; coutnum nametclast chineset mathstenglishttotaltsetprecision(3)averagenext; if (b=1) cout无此分数段的语文成绩记录!endl;/5(4)void chashuxue(student *head) /查询数学成绩功能 int h,l,b=1; cout请输入您要查询的【数学】成绩的分数段: endl; cout起始分 终止分l; cinh; cout此分数段的学生数学成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语 总分 均分maths=l)&(head-maths=h) b=0; coutnum nametclast chineset mathstenglishttotaltsetprecision(3)averagenext; if (b=1) cout无此分数段的数学成绩记录!endl;/5(5)void chayingyu(student *head) /查询英语成绩功能 int h,l,b=1; cout请输入您要查询的【英语】成绩的分数段: endl; cout起始分 终止分l; cinh; cout此分数段的学生英语成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语 总分 均分english=l)&(head-english=h) b=0; coutnum nametclast chineset mathstenglishttotaltsetprecision(3)averagenext; if (b=1) cout无此分数段的英语成绩记录!endl;/5(6)void chazongfen(student *head) /查询总分成绩功能 int h,l,b=1; cout请输入您要查询的【总分】成绩的分数段: endl; cout起始分 终止分l; cinh; cout此分数段的学生总分成绩信息是:endl; cout学号 姓名 班级 语文 数学 英语 总分 均分total=l)&(head-total=h) b=0; coutnum nametclast chineset mathstenglishttotaltsetprecision(3)averagenext; if (b=1) cout无此分数段的总分成绩记录!next; while (q) if (p-chinesechinese) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths=q-maths;q-maths=b; b=p-english;p-english=q-english;q-english=b; b=p-total;p-total=q-total;q-total=b; c=p-average;p-average=q-average;q-average=c; q=q-next; p=p-next; /6(2)void shuxue(student *head) /按数学成绩从高到低排序功能 student *p,*q; char a30; int b; float c; p=head; while (p) q=p-next; while (q) if (p-mathsmaths) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths=q-maths;q-maths=b; b=p-english;p-english=q-english;q-english=b; b=p-total;p-total=q-total;q-total=b; c=p-average;p-average=q-average;q-average=c; q=q-next; p=p-next; /6(3)void yingyu(student *head) /按英语成绩从高到低排序功能 student *p,*q; char a30; int b; float c; p=head; while (p) q=p-next; while (q) if (p-englishenglish) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths=q-maths;q-maths=b; b=p-english;p-english=q-english;q-english=b; b=p-total;p-total=q-total;q-total=b; c=p-average;p-average=q-average;q-average=c; q=q-next; p=p-next; /6(4)void zongfen(student *head) /按总分成绩从高到低排序功能 student *p,*q; char a30; int b; float c; p=head; while (p) q=p-next; while (q) if (p-totaltotal) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths=q-maths;q-maths=b; b=p-english;p-english=q-english;q-english=b; b=p-total;p-total=q-total;q-total=b; c=p-average;p-average=q-average;q-average=c; q=q-next; p=p-next; /7void xuehao(student *head) /按学号从小到大排序功能 student *p,*q; char a30; int b; float c; p=head; while (p) q=p-next; while (q) if (strcmp(p-num,q-num)0) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths=q-maths;q-maths=b; b=p-english;p-english=q-english;q-english=b; b=p-total;p-total=q-total;q-total=b; c=p-average;p-average=q-average;q-average=c; q=q-next; p=p-next; /8void xingming(student *head) /按姓名首字母排序功能 student *p,*q; char a30; int b; float c; p=head; while (p) q=p-next; while (q) if (strcmp(p-name,q-name)0) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths=q-maths;q-maths=b; b=p-english;p-english=q-english;q-english=b; b=p-total;p-total=q-total;q-total=b; c=p-average;p-average=q-average;q-average=c; q=q-next; p=p-next; /9void banji(student *head) /按班级的类别排序功能 student *p,*q; char a30; int b; float c; p=head; while (p) q=p-next; while (q) if (strcmp(p-clas,q-clas)0) strcpy(a,p-num);strcpy(p-num,q-num);strcpy(q-num,a); strcpy(a,p-name);strcpy(p-name,q-name);strcpy(q-name,a); strcpy(a,p-clas);strcpy(p-clas,q-clas);strcpy(q-clas,a); b=p-chinese;p-chinese=q-chinese;q-chinese=b; b=p-maths;p-maths=q-maths;q-maths=b; b=p-english;p-english=q-english;q-english=b; b=p-total;p-total=q-total;q-total=b; c=p-average;p-average=q-average;q-average=c; q=q-next; p=p-next; /10void show(student *head,char *s) /学生成绩信息文件导出功能 int n=1; ofstream outstuf; outstuf.open(s,ios:out); if (!outstuf) cerrfile could not be open.endl; abort(); outstuf学号 姓名 班级 语文 数学 英语 总分 均分 序号endl; while (head) outstufnum nametclast chineset mathstenglishttotalt setprecision(3)averaget nnext; outstuf.close();void main() student *head=NULL; int n; char s30; cout*; cout* 欢迎使用学生成绩管理系统 *; cout* 管理员: *; cout* 请选择您想使用的功能: *; cout* 功能名 请输入 功能名 请输入 *; cout* 导入学生成绩文件 1 按学号小到大排序 7 *; cout* 插入学生成绩信息 2 按姓名首字母排序 8 *; cout* 删除学生成绩信息 3 按班级的类别排序 9 *; cout* 修改学生成绩信息 4 导出学生成绩文件 10 *; cout* 查询学生成绩信息 5 其它功能. *; cout* 按成绩高到低排序 6 退出管理系统 0 *; cout*; coutn; createlist(head); while (n0) switch (n) case 1:cout导入的需管理的学生成绩信息表:endl; showlist(head); break; case 2:charu(head); cout插入后的学生成绩信息表:endl; showlist(head); break; case 3:shanchu(head); cout删除后的学生成绩信息表:endl; showlist(head); break; case 4:change(head); cout修改后的学生成绩信息表:endl; showlist(head); break; case 5:cout请选择查询学生成绩的方式:endl; cout 方式 请输入 方式 请输入 endl; cout 查询个人成绩 1 查询数学成绩 4 endl; cout 查询班级成绩 2 查询英语成绩 5 endl; cout 查询语文成绩 3 查询总分成绩 6 endl; coutn; switch (n) case 1:geren(head); break; case 2:zongfen(head); chabanji(head); break; case 3:yuwen(head); chayuwen(head); break; case 4:shuxue(head); chashuxue(head); break; case 5:yingyu(head); chayingyu(head); break; case 6:zongfen(head); chazongfen(head); break; break; case 6:cout请选择需排序的成绩的类型:endl; cout 类型 请输入 类型 请输入 endl; cout 按语文成绩排序 1 按英语成绩排序 3 endl; cout 按数学成绩排序 2 按总分成绩排序 4 endl; coutn; switch (n) case 1:yuwen(head); cout按【语文】成绩排序后的学生成绩信息表:endl; showlist(head); break; case 2:shuxue(head); cout按【数学】成绩排序后的学生成绩信息表:endl; showlist(head); break; case 3:yingyu(head); cout按【英语】成绩排序后的学生成绩信息表:endl; showlist(head); break; case 4:zongfen(head); cout按【总分】成绩排序后的学生成绩信息表:endl; showlist(head); break; break; case 7:xuehao(head); cout按【学号】从小到大排序后的学生成绩信息表:endl; showlist(head); break; case 8:xingming(head); cout按【姓名】首字母排序后的学生成绩信息表:endl; showlist(head); break; case 9:banji(head); cout按【班级】的类别排序后的学生成绩信息表:endl; showlist(head); break; case 10:cout请选择需导出的学生成绩数据文件的内容:endl; cout 内容 请输入 内容 请输入 ; cout 按总
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 小学语文常见的反义词总结
- 中国联通海东市2025秋招市场与服务类专业追问清单及参考回答
- 行政岗位考试试题及答案
- 中国广电常德市2025秋招笔试行测题库及答案网络优化与维护类
- 武威市中石化2025秋招笔试模拟题含答案油品分析质检岗
- 中国广电聊城市2025秋招笔试行测题库及答案行业解决方案经理岗
- 亳州市中石化2025秋招面试半结构化模拟题及答案新材料与新能源岗
- 大唐电力安庆市2025秋招采矿工程专业面试追问及参考回答
- 驻马店市中石油2025秋招面试半结构化模拟题及答案炼化装置操作岗
- 大庆市中石油2025秋招面试半结构化模拟题及答案炼化装置操作岗
- DB32-T 4757-2024 连栋塑料薄膜温室建造技术规范
- 2024年四川省广安市中考数学试题(含答案逐题解析)
- 山西省太原三十七中2023-2024学年九年级上学期月考物理试卷(10月份)
- (幻灯片)世界各国国旗大全中文
- 物流地产发展前景分析
- 三年个人成长路线图:高中数学名师工作室
- 子宫动脉栓塞护理查房
- 员工上下班交通安全知识培训课件
- 产品质量法-企业培训讲座
- 粮油品质检验与分析(第二版) 课件全套 第0-10章 绪论、粮食的理化特性与品质变化-粮油卫生检验
- 塑胶模具报价表范例
评论
0/150
提交评论