学生综合测评系统方案

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

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

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

资源描述

...参考学习#includestdio.h#includestdlib.h#includestring.h#includeiostream.hstructstudent*Read();voidsave(structstudent*head);voidsinput(structstudent*p);structstudent*input();voidpaixu_num(structstudent*head);structstudent*insert();structstudent*alter();structstudent*del();voidfind_num(structstudent*phead);voidfind_name(structstudent*phead);voidoutput();voidmin_student(structstudent*phead);voidmax_student(structstudent*phead);voidave_student(structstudent*phead);voidevery_student(structstudent*phead);voidscore_paixu(structstudent*head);voidhelp();voidtj_menu(structstudent*head);voidfind_menu(structstudent*head);voidmenu();structstudent{//定义学生信息结构数组,用于学生信息输入charnumber[13];charname[13];charsex[4];charadds[15];charphone[14];charqq[14];floatchinese,math,english,txhp,pinde,teacher;intzcmc,ksmc;doubleave,zc;structstudent*next;};#defineLensizeof(structstudent)intlen;//链表长度inta=0,b=0,c=0,d=0,e=0;//用来存放成绩各阶的人数...参考学习charstu[10];structstudent*Read(){//读取数据文件保存到链表中,返回指向此链表头指针structstudent*head=NULL;structstudent*p1,*p2;FILE*fp;cout请输入你要打开的文件(.dat)endl;cinstu;if((fp=fopen(stu,rb+))==NULL){cout打开文件出错!endl;exit(0);}while(!feof(fp)){if((p1=(structstudent*)malloc(Len))==NULL){cout内存申请出错endl;fclose(fp);exit(0);}if(fread(p1,Len,1,fp)!=1){free(p1);break;}if(head==NULL)head=p2=p1;else{p2-next=p1;p2=p1;}}fclose(fp);returnhead;}voidsave(structstudent*head){//数据存盘FILE*fp;structstudent*p;p=head;cout请输入你要存进去的文件(.dat)endl;...参考学习cinstu;if((fp=fopen(stu,wb))==NULL){cout无法打开文件!endl;system(pause);menu();}while(p){if(fwrite(p,Len,1,fp)!=1){cout写入数据出错endl;fclose(fp);return;}elsep=p-next;}cout数据存入成功!请按任意键继续!endl;getchar();fclose(fp);}//单次输入voidsinput(structstudent*p){cout请输入学号:endl;cinp-number;cout请输入姓名:endl;cinp-name;cout请输入性别:endl;cinp-sex;cout请输入家庭住址:endl;cinp-adds;cout请输入联系电话:endl;cinp-phone;cout请输入qq:endl;cinp-qq;cout请输入语文成绩:endl;cinp-chinese;if(p-chinese100||p-chinese0)...参考学习{cout成绩输入不符合规定,请重新输入:endl;cinp-chinese;}cout请输入数学成绩:endl;cinp-math;if(p-math100||p-math0){cout成绩输入不符合规定,请重新输入:endl;cinp-math;}cout请输入英语成绩:endl;cinp-english;if(p-english100||p-english0){cout成绩输入不符合规定,请重新输入:endl;cinp-english;}cout请输入同学互评分:endl;cinp-txhp;if(p-txhp100||p-txhp0){cout成绩输入不符合规定,请重新输入:endl;cinp-txhp;}cout请输入品德成绩:endl;cinp-pinde;if(p-pinde100||p-pinde0){cout成绩输入不符合规定,请重新输入:endl;cinp-pinde;}cout请输入任课教师评分:endl;cinp-teacher;if(p-teacher100||p-teacher0){cout成绩输入不符合规定,请重新输入:endl;cinp-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;cout\t\t学号:p-numberendl;cout\t\t姓名:p-nameendl;cout\t\t性别:p-sexendl;cout\t\t家庭住址:p-addsendl;cout\t\t联系电话:p-phoneendl;cout\t\tQQ号:p-qqendl;cout\t\t语文成绩:p-chineseendl;cout\t\t数学成绩:p-mathendl;cout\t\t英语成绩:p-englishendl;cout\t\t品德成绩:p-pindeendl;cout\t\t教师评分:p-teacherendl;cout☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆endl;return;}//学生成绩录入函数structstudent*input(){structstudent*head=NULL,*p1,*p2;//输入p1,p2链表最后节点charch='y';len=1;p2=p1=(structstudent*)malloc(sizeof(structstudent));cout请输入第len个学生的信息:endl;sinput(p1);coutendl;cout按n退出或按任意键继续endl;;cinch;while(1){if(len==1)//作为头结点head=p1;elsep2-next=p1;p2=p1;if(ch=='N'||ch=='n')break;p1=(structstudent*)malloc(sizeof(structstudent));system(cls);len++;...参考学习cout请输入第len个学生的信息:endl;;sinput(p1);coutendl;cout按n退出或按任意键继续endl;;cinch;}p2-next=NULL;paixu_num(head);cout输入学生信息完成!请按任意键返回主菜单!endl;getchar();returnhead;}//学号排序voidpaixu_num(structstudent*head){structstudentt,*r,*p,*q;//t交换p、q,r头结点r=head;if(r==NULL){cout学生信息不存在,请先输入学生信息!endl;return;}while(r){p=r;q=r-next;while(q){if(strcmp(q-number,p-number)0)//qp{strcpy(t.number,q-number);strcpy(t.name,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.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-pinde;q-teacher=p-teacher;strcpy(p-number,t.number);strcpy(p-name,t.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;}}//插入函数structstudent*insert(){structstudent*p,*p1,*head;head=Read();p1=head;p=(structstudent*)malloc(sizeof(structstudent));charnum[14],ch;cout请输入你要插入的前一个学生的学号:endl;cinnum;...参考学习while(p1){if(!strcmp(p1-number,num)){sinput(p);p-next=p1-next;p1-next=p;len++;}elsep1=p1-next;cout按n退

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

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

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

×
保存成功