学生综合测评系统_第1页
学生综合测评系统_第2页
学生综合测评系统_第3页
学生综合测评系统_第4页
学生综合测评系统_第5页
已阅读5页,还剩23页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、includeinclude stdlib.hinclude string.h#include struct student *Read();void save(struct student *head);void sinput(struct student *p);struct student *input();void paixu_num(struct student *head);struct student *insert();struct student *alter();struct student *del();void find_num(struct student *phea

2、d);void find_name(struct student *phead);void output();void min_student(struct student *phead);void max_student(struct student *phead);void ave_student(struct student *phead);void every_student(struct student *phead);void score_paixu(struct student *head);void help();void tj_menu(struct student *hea

3、d);void find_menu(struct student *head);void menu();struct student/ 定义学生信息结构数组,用于学生信息输入char number13;char name13;char sex4;char adds15;char phone14;char qq14;float chinese,math,english,txhp,pinde,teacher;int zcmc,ksmc;double ave,zc;struct student *next;#define Len sizeof(struct student)int len; / 链表

4、长度int a=0,b=0,c=0,d=0,e=0;/ 用来存放成绩各阶的人数char stu10;, 返回指向此链表头指针struct student *Read() / 读取数据文件保存到链表中struct student *head=NULL;struct student *p1, *p2;FILE *fp;cout 请输入你要打开的文件(.dat)stu;if(fp=fopen(stu,rb+)=NULL)cout 打开文件出错!endl;exit(0);while(!feof(fp) if( (p1=(struct student*)malloc(Len)=NULL )cout 内存

5、申请出错next=p1;p2=p1;fclose(fp);return head;void save(struct student *head)/ 数据存盘FILE *fp;struct student *p;p=head;cout 请输入你要存进去的文件(.dat)stu;if(fp = fopen(stu, wb)=NULL)cout 无法打开文件!endl;system(pause);menu();while(p)if(fwrite(p,Len,1,fp)!=1)cout 写入数据出错next;cout 数据存入成功! 请按任意键继续!endl;getchar();fclose(fp);

6、/ 单次输入void sinput(struct student *p)cout 请输入学号:p-number;cout 请输入姓名: p-name;cout 请输入性别: p-sex;cout 请输入家庭住址: p-adds;cout 请输入联系电话: p-phone;cout 请输入 qq: p-qq;cout 请输入语文成绩:p-chinese;if(p-chinese100|p-chinese0)cout 成绩输入不符合规定,请重新输入:p-chinese;cout 请输入数学成绩:p-math;if(p-math100|p-math0)cout 成绩输入不符合规定,请重新输入:p-m

7、ath;cout 请输入英语成绩:p-english;if(p-english100|p-english0)cout 成绩输入不符合规定,请重新输入:p-english;cout 请输入同学互评分:p-txhp;if(p-txhp100|p-txhp0)cout 成绩输入不符合规定,请重新输入:p-txhp;cout 请输入品德成绩:p-pinde;if(p-pinde100|p-pinde0)cout 成绩输入不符合规定,请重新输入:p-pinde;cout 请输入任课教师评分:p-teacher;if(p-teacher100|p-teacher0)cout 成绩输入不符合规定,请重新输入

8、:p-teacher;p-ave=(p-chinese+p-math+p-english)/3.0;p-zc=(p-ave*0.6+p-txhp*0.1+p-pinde*0.2+p-teacher*0.1);coutendl;cout endl;cout 你刚输入的信息为:endl;couttt 学号 :numberendl;couttt姓名:nameendl;couttt性别:sexendl;couttt家庭住址:addsendl;couttt联系电话:phoneendl;coutttQQ 号 :qqendl;couttt 语文成绩:chineseendl;couttt数学成绩:mathen

9、dl;couttt英语成绩:englishendl;couttt品德成绩:pindeendl;couttt教师评分:teacherendl;cout endl;return;/ 学生成绩录入函数struct student *input()struct student *head=NULL,*p1,*p2;/ 输入 p1,p2 链表最后节点char ch=y;len=1;p2=p1=(struct student *)malloc(sizeof(struct student);cout 请输入第len 个学生的信息:endl;sinput(p1);coutendl;cout 按 n 退出或按任

10、意键继续ch;while(1)if(len=1)/ 作为头结点head=p1;elsep2-next=p1;p2=p1;if(ch=N|ch=n)break;p1=(struct student *)malloc(sizeof(struct student);system(cls);len+;cout 请输入第len 个学生的信息:endl;sinput(p1);coutendl;cout 按 n 退出或按任意键继续ch;p2-next=NULL;paixu_num(head);cout 输入学生信息完成! 请按任意键返回主菜单!endl;getchar();return head;/ 学号排

11、序void paixu_num(struct student *head)struct student t,*r,*p,*q;/t交换 p、 q, r 头结点r=head;if(r=NULL)cout 学生信息不存在, 请先输入学生信息!next;while(q)if(strcmp(q-number,p-number)0) /qnumber);strcpy(,q-name);strcpy(t.sex,q-sex);strcpy(t.adds,q-adds);strcpy(t.phone,q-phone);strcpy(t.qq,q-qq);t.chinese=q-chinese;t

12、.math=q-math;t.english=q-english;t.txhp=q-txhp;t.pinde=q-pinde;t.teacher=q-teacher;strcpy(q-number,p-number); strcpy(q-name,p-name);strcpy(q-sex,p-sex); strcpy(q-adds,p-adds); strcpy(q-phone,p-phone); strcpy(q-qq,p-qq);q-chinese=p-chinese; q-math=p-math;q-english=p-english;q-txhp=p-txhp;q-pinde=p-pi

13、nde;q-teacher=p-teacher;strcpy(p-number,t.number);strcpy(p-name,);strcpy(p-sex,t.sex);strcpy(p-adds,t.adds);strcpy(p-phone,t.phone);strcpy(p-qq,t.qq);p-chinese=t.chinese;p-math=t.math;p-english=t.english;p-txhp=t.txhp;p-pinde=t.pinde;p-teacher=t.teacher;q=q-next;r=r-next;/ 插入函数struct student *

14、insert()struct student *p,*p1,*head;head=Read();p1=head;p=(struct student *)malloc(sizeof(struct student);char num14,ch;cout 请输入你要插入的前一个学生的学号:num;while(p1)if(!strcmp(p1-number,num)sinput(p);p-next=p1-next;p1-next=p;len+;elsep1=p1-next;cout 按 n 退出或按任意键继续ch;if(ch=N|ch=n)break;cout 学生信息插入成功!请按任意键返回!end

15、l;getchar();return head;/ 修改学生信息struct student *alter()char temp13;struct student *p,*head;head=Read();p=head;couttemp;while(p)if(!strcmp(p-number,temp)sinput(p);p=p-next;coutendl;cout 学生信息修改成功!请按任意键返回!endl;coutendl;system(pause);return head;/ 删除学生信息struct student *del()char temp13;int m=0;struct st

16、udent *p1,*p,*head;/p1删除head=Read();p1=p=head;cout 请输入你要删除学生的学号:temp;while(p)if(strcmp(p1-number,temp)=0)if(p1=head)/ 删除的头结点head=p1-next;elsep-next=p1-next;len-;m=1;cout 学生信息删除成功!请按任意键返回主菜单next;if(!m)cout 查找不到这个信息!endl;return head;void find_num(struct student *head)/ 按学号查找struct student *p=head;char

17、 temp9;int m = 0;cout 请输入要查找的学生的学号temp;while(p!=NULL)if(strcmp(p-number,temp) = 0)cout该学生的具体信息为: vvendl;coutvendl;cout couttt 学号:p-numberendl;couttt 姓名:p-nameendl;couttt性别:vvp-sexvendl;couttt家庭住址:p-addsendl;couttt 联系电话:p-phoneendl;coutttQQ 号:p-qqendl;couttt 语文成绩: couttt 数学成绩 couttt 英语成绩 couttt 平均成绩

18、couttt 品德成绩 couttt 老师评分 couttt 综合成绩 score_paixu(head);couttt 考试名次 couttt 综测名次p-chineseendl p-mathendl; p-englishendl; p-aveendl;p-pindeendl; p-teacherendl; p-zcendl;p-ksmcendl; p-zcmcendl;m=1;)p= p-next;/ 继续向下寻找)if(!m)!endl;endl;cout查找不到这个学号的信息cout按任意键返回主菜单getchar();return ;)void find_name(struct st

19、udent *head)/按姓名查找(struct student *p= head;char temp9;int m = 0;coutvv”请输入要查找的学生的姓名vvendl;cintemp;while(p)if(strcmp(p-name,temp) = 0)cout该学生的具体信息为:vvendl;coutvendl;cout cout :p-numberendl;couttt 姓名:p-nameendl;couttt 性别:p-sexendl;couttt家庭住址:p-addsendl;couttt联系电话:vvp-phonevendl;coutttQQ 号:p-qqendl;cou

20、ttt 语文成绩: couttt 数学成绩 couttt 英语成绩 couttt 平均成绩 couttt 品德成绩 couttt 老师评分 couttt 综合成绩 score_paixu(head);couttt 考试名次 couttt 综测名次p-chineseendl p-mathendl; p-englishendl; p-aveendl;p-pindeendl; p-teacherendl; p-zcendl;p-ksmcendl;p-zcmcendl;m=1;)p=p-next;)if(!m)cout查找不到这个学号的信息!”vendl;cout按任意键返回主菜单vvendl;get

21、char(); return ;) void output()(struct student *p,*head;head=Read();p=head;int i=1;while(p)(coutcouttt 学号:p-numberendl; couttt 姓名:p-nameendl;couttt 性别:p-sexendl;couttt 家庭住址:p-addsendl;couttt 联系电话:p-phoneendl;coutttQQ 号:p-qqendl;couttt语文成绩:p-chineseendl;couttt 数学成绩:p-mathendl;couttt 英语成绩:p-englishend

22、l;couttt 品德成绩:p-pindeendl;couttt 老师评分:vvp-teachevendl;couttt 平均成绩:p-aveendl;couttt 综合成绩:p-zcendl;score_paixu(head);couttt 考试名次vvp-ksmcvendl;couttt综合测评名次vvp-zcmcvendl;p=p-next;i+;)cout 探姐ndl;coutendl;coutvv请按任意键返回主菜单 endl;getchar();return ;)void max_student(struct student *head)struct student *p=head

23、;float c2=0,m2=0,e2=0,s2=0,p2=0,stu2=0,t2=0;double a2=0,zc2=0;while(p)if(p-chinesec2)c2=p-chinese;if(p-mathm2)m2=p-math;if(p-englishe2)e2=p-english;if(p-chinese+p-math+p-english)s2)s2=(p-chinese+p-math+p-english);if(p-pindep2)p2=p-pinde;if(p-txhpstu2)stu2=p-txhp;if(p-teachert2)t2=p-teacher;if(p-avea

24、2)a2=p-ave;if(p-zczc2)zc2=p-zc;p=p-next;cout endl;couttt语文最高分:c2endl;couttt数学最高分:m2endl;couttt英语最高分:e2endl;couttt总成绩最高分:s2endl;couttt品德最高分:p2endl;couttt 同学互评分最高:stu2endl;couttt 教师评分最高:t2endl;couttt平均分最高:a2endl;couttt综测最高分:zc2endl;cout endl;coutendl;cout 请按任意键返回chinesechinese;if(p-mathmath;if(p-engli

25、shenglish;if(p-chinese+p-math+p-english)chinese+p-math+p-english);if(p-pindepinde;if(p-txhptxhp;if(p-teacherteacher;if(p-aveave;if(p-zczc;p=p-next;cout endl;couttt语文最低分:c1endl;couttt数学最低分:m1endl;couttt英语最低分:e1endl;couttt总成绩最低分:s1endl;couttt品德最低分:p1endl;couttt 同学互评分最低分:stu1endl;couttt 教师评分最低分:t1endl;

26、couttt 平均分最低分:a1endl;couttt 综测最低分:zc1endl;cout endl;coutendl;cout 请按任意键返回chinese;m_sum+=p-math;e_sum+=p-english;p_sum+=p-pinde;stu_sum+=p-txhp;t_sum+=p-teacher;zc_sum+=p-zc;p=p-next;c_ave=c_sum/len;m_ave=m_sum/len;e_ave=e_sum/len;all_ave=(c_ave+m_ave+e_ave)/3;p_ave=p_sum/len;stu_ave=stu_sum/len;t_av

27、e=t_sum/len;zc_ave=zc_sum/len;couttt endl;couttt语文平均分为:c_aveendl;couttt数学平均分为:m_aveendl;couttt英语平均分为:e_aveendl;couttt总成绩平均为:all_aveendl;couttt品德平均分为:p_aveendl;couttt同学互评平均分为:stu_aveendl;couttt教师评分平均分为:t_aveendl;couttt综测平均分为:zc_aveendl;couttt endl;coutendl;cout 请按任意键返回ave/10)case 10:case 9:a+;break;c

28、ase 8:b+;break;case 7:c+;break;case 6:d+;break;default:e+;p=p-next;cout endl;cout 平均成绩在90分以上的有:aendl;cout 平均成绩在80分以上的有:bendl;cout 平均成绩在70分以上的有:cendl;cout 平均成绩在60 分以上的有:dendl;cout 平均成绩在60 分以下的有:echinese/10) case 10: case 9:a+;break;case 8:b+;break;case 7:c+;break;case 6:d+;break; default:e+;p=p-next;

29、cout endl;cout 语文成绩在90 分以上的有:aendl;cout 语文成绩在80 分以上的有:bendl;cout 语文成绩在70 分以上的有:cendl;cout 语文成绩在60 分以上的有:dendl;cout 语文成绩在60 分以下的有:emath/10)case 10: case 9:a+;break;case 8:b+;break;case 7:c+;break;case 6:d+;break; default:e+;p=p-next; cout cout cout cout coutcout数学成绩在 数学成绩在 数学成绩在 数学成绩在 数学成绩在90 分以上的有:8

30、0 分以上的有:70 分以上的有:60 分以上的有:60 分以下的有:aendl;bendl;cendl;dendl;eenglish/10)case 10:case 9:a+;break;case 8:b+;break;case 7:c+;break;case 6:d+;break; default:e+;p=p-next;cout cout cout cout cout cout英语成绩在 英语成绩在 英语成绩在 英语成绩在 英语成绩在90 分以上的有:80 分以上的有:70 分以上的有:60 分以上的有:60 分以下的有:aendl;bendl;cendl;dendl;epinde/10

31、)case 10:case 9:a+;break;case 8:b+;break;case 7:c+;break;case 6:d+;break; default:e+;p=p-next;90 分以上的有:80 分以上的有:70 分以上的有:60 分以上的有:60 分以下的有:aendl;bendl;cendl;dendl;eendl; cout cout cout cout cout couttxhp/10)case 10:case 9:a+;break;case 8:b+;break;case 7:c+;break;case 6:d+;break;default:e+;)p=p-next;

32、)cout 长姐ndl;90分以上的有:80分以上的有:70分以上的有:60分以上的有:60分以下的有:aendl;bendl;cendl;dendl;eendl;cout同学互评在 cout同学互评在 cout同学互评在 cout同学互评在 cout同学互评在while(p)switch(int)p-teacher/10)case 10:case 9:a+;break;case 8:b+;break;case 7:c+;break;case 6:d+;break;default:e+;)p=p-next;)cout 长姐ndl;90分以上的有:80分以上的有:70分以上的有:60分以上的有:

33、60分以下的有:aendl;bendl;cendl;dendl;eendl;cout教师评分在 cout教师评分在 cout教师评分在 cout教师评分在 cout教师评分在while(p)switch(int)p-zc/10)case 10:case 9:a+;break;case 8:b+;break;case 7:c+;break;case 6:d+;break;default:e+;)p=p-next;cout 长姐ndl;cout 综测成绩在90 分以上的有:aendl;cout 综测成绩在80 分以上的有:bendl;cout 综测成绩在70 分以上的有:cendl;cout 综测

34、成绩在60 分以上的有:dendl;cout 综测成绩在60 分以下的有:eendl;cout endl;cout 请按任意键退出next;double *ave1=new doublen;double *zc1=new doublen;for(int i=0;iave;zc1i=p1-zc;p1=p1-next;for(i=0;in;i+)/ 冒泡排序for(int j=0;jn;j+)if(ave1jave1j+1)double ave11=ave1j;ave1j=ave1j+1;ave1j+1=ave11;if(zc1jzc1j+1)double zc11=zc1j;zc1j=zc1j+

35、1;zc1j+1=zc11;while(r)for(i=0;iave)r-ksmc=i+1;if(zc1i=r-zc)r-zcmc=i+1;r=r-next;!( 如果是浏览学生信息cout 排名完成! 请按任意键返回主菜单的浏览学生信息查看则按任意键得到名次!)endl;delete ave1;delete zc1;getchar(); return; / 帮助void help()system (cls);/ 清屏cout * 欢迎使用学生综合测评系统* endl;coutendl;cout 本系统可以存储学生的基本信息和数据信息,所有信息按学号以小到大的顺序存入文件。 endl;cout

36、 基本信息包括:学号、姓名、性别、家庭住址、联系电话、qqendl;cout 数据信息包括:语文、数学、外语三门单科成绩、考试平均成绩、考试名次、同学互评分、品德成绩、任课教师评分、综合测评分、综合测评名次endl;cout 综合测评分(考试平均成绩)*0.6+ (同学互评分)*0.1+ 品德成绩*0.1+ 任课老师评分 *0.2 。 endl;cout 考试成绩(语文+数学+外语)/3 endl;coutendl;cout 该菜单分为三个菜单,一个主菜单,两个子菜单。endl;cout 主菜单提供基本信息操作,子菜单分别提供学生信息查找功能、学生数据统计功能。endl;coutendl;co

37、ut 希望帮助对您有用endl;coutendl;system(pause);void tj_menu(struct student *head)int c;for(;)system(cls);coutnntt 学生数据统计菜单endl;coutendl;coutttt*endl;coutttt*1.*coutttt*2.*coutttt*3.*coutttt*4.*coutttt*5.*coutttt*0.*各科成绩最高分 各科成绩最低分 各科成绩平均分 各个分数段人数 成绩排序 返回主菜单*endl;*endl;*endl;*endl;*endl;*endl;coutttt*endl;cout 当前已录入(表示当次录入的学生数量!)len 人信息 endl;cout 请输入序号选择操作(05):c;system(cls);switch(c)case 0:menu();break;case 1:max_student(head);break;case 2:min_student(head);break;case 3:ave_student(head);break;case 4:every_student(head);break;case 5:score_paixu(head);break;default:cout 输入有误!请重新输

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论