學生綜合測評系統(tǒng)_第1頁
學生綜合測評系統(tǒng)_第2頁
學生綜合測評系統(tǒng)_第3頁
學生綜合測評系統(tǒng)_第4頁
學生綜合測評系統(tǒng)_第5頁
已閱讀5頁,還剩23頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

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 數據存入成功! 請按任意鍵繼續(xù)!endl;getchar();fclose(fp);

6、/ 單次輸入void sinput(struct student *p)cout 請輸入學號:p-number;cout 請輸入姓名: p-name;cout 請輸入性別: p-sex;cout 請輸入家庭住址: p-adds;cout 請輸入聯(lián)系電話: p-phone;cout 請輸入 qq: p-qq;cout 請輸入語文成績:p-chinese;if(p-chinese100|p-chinese0)cout 成績輸入不符合規(guī)定,請重新輸入:p-chinese;cout 請輸入數學成績:p-math;if(p-math100|p-math0)cout 成績輸入不符合規(guī)定,請重新輸入:p-m

7、ath;cout 請輸入英語成績:p-english;if(p-english100|p-english0)cout 成績輸入不符合規(guī)定,請重新輸入:p-english;cout 請輸入同學互評分:p-txhp;if(p-txhp100|p-txhp0)cout 成績輸入不符合規(guī)定,請重新輸入:p-txhp;cout 請輸入品德成績:p-pinde;if(p-pinde100|p-pinde0)cout 成績輸入不符合規(guī)定,請重新輸入:p-pinde;cout 請輸入任課教師評分:p-teacher;if(p-teacher100|p-teacher0)cout 成績輸入不符合規(guī)定,請重新輸入

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聯(lián)系電話: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 鏈表最后節(jié)點char ch=y;len=1;p2=p1=(struct student *)malloc(sizeof(struct student);cout 請輸入第len 個學生的信息:endl;sinput(p1);coutendl;cout 按 n 退出或按任

10、意鍵繼續(xù)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 退出或按任意鍵繼續(xù)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 退出或按任意鍵繼續(xù)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 聯(lián)系電話: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;/ 繼續(xù)向下尋找)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聯(lián)系電話: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 聯(lián)系電話: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 * 歡迎使用學生綜合測評系統(tǒng)* endl;coutendl;cout 本系統(tǒng)可以存儲學生的基本信息和數據信息,所有信息按學號以小到大的順序存入文件。 endl;cout

36、 基本信息包括:學號、姓名、性別、家庭住址、聯(lián)系電話、qqendl;cout 數據信息包括:語文、數學、外語三門單科成績、考試平均成績、考試名次、同學互評分、品德成績、任課教師評分、綜合測評分、綜合測評名次endl;cout 綜合測評分(考試平均成績)*0.6+ (同學互評分)*0.1+ 品德成績*0.1+ 任課老師評分 *0.2 。 endl;cout 考試成績(語文+數學+外語)/3 endl;coutendl;cout 該菜單分為三個菜單,一個主菜單,兩個子菜單。endl;cout 主菜單提供基本信息操作,子菜單分別提供學生信息查找功能、學生數據統(tǒng)計功能。endl;coutendl;co

37、ut 希望幫助對您有用endl;coutendl;system(pause);void tj_menu(struct student *head)int c;for(;)system(cls);coutnntt 學生數據統(tǒng)計菜單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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論