收藏 分销(赏)

c大作业学生信息标准管理系统源代码.docx

上传人:精*** 文档编号:2827623 上传时间:2024-06-06 格式:DOCX 页数:25 大小:17.53KB
下载 相关 举报
c大作业学生信息标准管理系统源代码.docx_第1页
第1页 / 共25页
c大作业学生信息标准管理系统源代码.docx_第2页
第2页 / 共25页
c大作业学生信息标准管理系统源代码.docx_第3页
第3页 / 共25页
c大作业学生信息标准管理系统源代码.docx_第4页
第4页 / 共25页
c大作业学生信息标准管理系统源代码.docx_第5页
第5页 / 共25页
点击查看更多>>
资源描述

1、学生信息管理系统源代码:#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,eng

2、lish0;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-e

3、nglish; 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 ch

4、aru(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(stu

5、dent * & 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-ne

6、xt; 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学号 姓名 班级 语文 数学 英语e

7、ndl; 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 gere

8、n(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;

9、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此分数段学生语文

10、成绩信息是: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此分数段学生数学成绩信息

11、是: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;

12、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; cou

13、t学号 姓名 班级 语文 数学 英语 总分 均分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)

14、; 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 sh

15、uxue(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

16、=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;

17、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-

18、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) i

19、f (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-

20、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);strc

21、py(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-avera

22、ge;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);st

23、rcpy(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

24、; /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);str

25、cpy(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=

26、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

27、; 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);

28、 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;

29、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 类型 请输入 类型

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 教育专区 > 其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服