C+課程設計學生成績管理系統(tǒng)樣一_第1頁
C+課程設計學生成績管理系統(tǒng)樣一_第2頁
C+課程設計學生成績管理系統(tǒng)樣一_第3頁
C+課程設計學生成績管理系統(tǒng)樣一_第4頁
C+課程設計學生成績管理系統(tǒng)樣一_第5頁
已閱讀5頁,還剩7頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、#include #includeclass STUpublic:long int xh; char xm20,xb20,jg20; float c,eng,phy;STU *next; friend class BJ;class BJpublic:STU *create(int n)STU *p,*pend,*h=0;int i=0;if(n1)return 0; cout學號 姓名 性別 籍貫 VC+成績 英語成績 物理成績endl;while(i(*p).xh(*p).xm(*p).xb(*p).jg(*p).c(*p).eng(*p).phy;(*p).next=0;if(h=0)h=

2、p;pend=p;elsepend-next=p;pend=p;i+;return h;void print(STU *h)STU *p;p=h; cout學號 姓名 性別 籍貫 vc+成績 英語成績 物理成績endl;while(p) cout(*p).xht(*p).xmt(*p).xbt(*p).jgt(*p).ct(*p).engt(*p).phyn; p=(*p).next;void count(STU *h,int n) float S20,aver20,aver1=0,aver2=0,aver3=0,MAX,max1,max2,max3; float s120,s220,s320

3、; STU *p; p=h; for(int i=0;in;i+) Si=(*p).c+(*p).eng+(*p).phy; averi=Si/3; p=(*p).next; for(p=h,i=0;in;i+) aver1+=(*p).c; aver2+=(*p).eng; aver3+=(*p).phy; p=(*p).next; aver1=aver1/n; aver2=aver2/n; aver3=aver3/n; for(p=h,i=0;in;i+)s1i=(*p).c;s2i=(*p).c;s3i=(*p).phy;p=(*p).next; MAX=0;max1=0;max2=0;

4、max3=0; for(i=0;in;i+) if(MAXSi)MAX=Si; if(max1s1i)max1=s1i; if(max2s2i)max2=s2i; if(max3s3i)max3=s3i; cout總成績最高的學生:n; for(p=h,i=0;in;i+) if(MAX=Si) cout(*p).xht(*p).xmtMAXendl; p=(*p).next; coutVC+成績最高的學生:n; for(p=h,i=0;in;i+)if(max1=s1i)cout(*p).xht(*p).xmtmax1endl;p=(*p).next; cout英語成績最高的學生:n; fo

5、r(p=h,i=0;in;i+)if(max2=s2i)cout(*p).xht(*p).xmtmax2endl;p=(*p).next; cout物理成績最高的學生:n; for(p=h,i=0;in;i+)if(max3=s3i)cout(*p).xht(*p).xmtmax3endl;p=(*p).next;void search(STU *h)STU *p;p=h;int r,t;char xm10;cout按學號查詢請輸入1,按姓名查詢請輸入2!r;switch(r)case 1: cout請輸入要查詢的學號:t; while(p) if(*p).xh=t)print(p);brea

6、k;else p=(*p).next; break;case 2:cout請輸入要查詢的姓名:xm;while(p)if( strcmp(xm,(*p).xm)=0) print(p);break;else p=(*p).next;break;void sort(STU *h,int a,int n) STU *p,*p1,*p2;long int XH;char XM20,XB20,JG20; float S20,aver20,VC,ENGLISH,PHYSICS;p=h;for(int i=0;in;i+)Si=(*p).c+(*p).eng+(*p).phy; averi=Si/3; p

7、=(*p).next; cout請選擇排序方式!endl; cout按姓名排序請輸入1endl;cout按VC+成績排序請輸入2endl;cout按英語成績排序請輸入3endl;cout按物理成績排序請輸入4endl;cout按總成績排序請輸入5endl;cout按平均成績排序請輸入6a;switch(a)case 1:if(h=0)cout無結點n; else p1=h; while(*p1).next) for(i=0;in-1;i+)p2=(*p1).next;for(int j=i+1;jn;j+)if(strcmp(*p1).xm,(*p2).xm)=1)XH=(*p1).xh;(*

8、p1).xh=(*p2).xh;(*p2).xh=XH;strcpy(XM,(*p1).xm);strcpy(*p1).xm,(*p2).xm);strcpy(*p2).xm,XM);strcpy(XB,(*p1).xb);strcpy(*p1).xb,(*p2).xb);strcpy(*p2).xb,XB);strcpy(JG,(*p1).jg);strcpy(*p1).jg,(*p2).jg);strcpy(*p2).jg,JG);VC=(*p1).c;(*p1).c=(*p2).c;(*p2).c=VC;ENGLISH=(*p1).eng;(*p1).eng=(*p2).eng;(*p2

9、).eng=ENGLISH;PHYSICS=(*p1).phy; (*p1).phy=(*p2).phy; (*p2).phy=PHYSICS; p2=(*p2).next; p1=(*p1).next;p=h;for( i=0;in;i+)print(p);p=(*p).next;coutendl;break;case 2:if(h=0)cout無結點n; else p1=h; while(*p1).next) for(i=0;in-1;i+)p2=(*p1).next; for(int j=i+1;j=(*p2).c)XH=(*p1).xh;(*p1).xh=(*p2).xh;(*p2).

10、xh=XH;strcpy(XM,(*p1).xm);strcpy(*p1).xm,(*p2).xm);strcpy(*p2).xm,XM);strcpy(XB,(*p1).xb);strcpy(*p1).xb,(*p2).xb);strcpy(*p2).xb,XB);strcpy(JG,(*p1).jg);strcpy(*p1).jg,(*p2).jg);strcpy(*p2).jg,JG);VC=(*p1).c;(*p1).c=(*p2).c;(*p2).c=VC;ENGLISH=(*p1).eng;(*p1).eng=(*p2).eng;(*p2).eng=ENGLISH;PHYSICS=

11、(*p1).phy; (*p1).phy=(*p2).phy; (*p2).phy=PHYSICS; p2=(*p2).next; p1=(*p1).next;p=h;for(i=0;in;i+)print(p);p=(*p).next;coutendl;break;case 3:if(h=0)cout無結點n; else p1=h;while(*p1).next)for( i=0;in-1;i+)p2=(*p1).next; for(int j=i+1;j=(*p2).eng) XH=(*p1).xh;(*p1).xh=(*p2).xh;(*p2).xh=XH; strcpy(XM,(*p1

12、).xm);strcpy(*p1).xm,(*p2).xm);strcpy(*p2).xm,XM); strcpy(XB,(*p1).xb);strcpy(*p1).xb,(*p2).xb);strcpy(*p2).xb,XB); strcpy(JG,(*p1).jg);strcpy(*p1).jg,(*p2).jg);strcpy(*p2).jg,JG); VC=(*p1).c;(*p1).c=(*p2).c;(*p2).c=VC; ENGLISH=(*p1).eng;(*p1).eng=(*p2).eng;(*p2).eng=ENGLISH; PHYSICS=(*p1).phy; (*p1

13、).phy=(*p2).phy; (*p2).phy=PHYSICS; p2=(*p2).next; p1=(*p1).next; p=h;for(i=0;in;i+)print(p);p=(*p).next;coutendl;break;case 4:if(h=0)cout無結點n; else p1=h; while(*p1).next) for(i=0;in-1;i+)p2=(*p1).next;for(int j=i+1;j=(*p2).c)XH=(*p1).xh;(*p1).xh=(*p2).xh;(*p2).xh=XH;strcpy(XM,(*p1).xm);strcpy(*p1).

14、xm,(*p2).xm);strcpy(*p2).xm,XM);strcpy(XB,(*p1).xb);strcpy(*p1).xb,(*p2).xb);strcpy(*p2).xb,XB);strcpy(JG,(*p1).jg);strcpy(*p1).jg,(*p2).jg);strcpy(*p2).jg,JG);VC=(*p1).c;(*p1).c=(*p2).c;(*p2).c=VC;ENGLISH=(*p1).eng;(*p1).eng=(*p2).eng;(*p2).eng=ENGLISH;PHYSICS=(*p1).phy; (*p1).phy=(*p2).phy; (*p2).

15、phy=PHYSICS; p2=(*p2).next; p1=(*p1).next; p=h;for(i=0;in;i+)print(p);p=(*p).next;coutendl;break;case 5:if(h=0)cout無結點n; else p1=h; while(*p1).next) for( i=0;in-1;i+) p2=(*p1).next;for(int j=i+1;j=Sj)XH=(*p1).xh;(*p1).xh=(*p2).xh;(*p2).xh=XH;strcpy(XM,(*p1).xm);strcpy(*p1).xm,(*p2).xm);strcpy(*p2).x

16、m,XM);strcpy(XB,(*p1).xb);strcpy(*p1).xb,(*p2).xb);strcpy(*p2).xb,XB);strcpy(JG,(*p1).jg);strcpy(*p1).jg,(*p2).jg);strcpy(*p2).jg,JG);VC=(*p1).c;(*p1).c=(*p2).c;(*p2).c=VC;ENGLISH=(*p1).eng;(*p1).eng=(*p2).eng;(*p2).eng=ENGLISH;PHYSICS=(*p1).phy; (*p1).phy=(*p2).phy; (*p2).phy=PHYSICS; p2=(*p2).next

17、; p1=(*p1).next;p=h;for(i=0;in;i+)cout(*p).xht(*p).xmt(*p).xbt(*p).jgt(*p).ct(*p).engt(*p).phytSin;p=(*p).next;coutendl;break;case 6:if(h=0)cout無結點n; else p1=h; while(*p1).next) for( i=0;in-1;i+)p2=(*p1).next;for(int j=i+1;j=averj)XH=(*p1).xh;(*p1).xh=(*p2).xh;(*p2).xh=XH;strcpy(XM,(*p1).xm);strcpy(

18、*p1).xm,(*p2).xm);strcpy(*p2).xm,XM);strcpy(XB,(*p1).xb);strcpy(*p1).xb,(*p2).xb);strcpy(*p2).xb,XB);strcpy(JG,(*p1).jg);strcpy(*p1).jg,(*p2).jg);strcpy(*p2).jg,JG);VC=(*p1).c;(*p1).c=(*p2).c;(*p2).c=VC;ENGLISH=(*p1).eng;(*p1).eng=(*p2).eng;(*p2).eng=ENGLISH;PHYSICS=(*p1).phy; (*p1).phy=(*p2).phy; (

19、*p2).phy=PHYSICS; p2=(*p2).next; p1=(*p1).next;p=h;for(i=0;in;i+) cout(*p).xht(*p).xmt(*p).xbt(*p).jgt(*p).ct(*p).engt(*p).phytaverin;p=(*p).next;coutendl;break;default: cout無可排序的依據(jù)!endl; void deleteSTU(STU *h,int data)STU *p1,*p2;int b;cout如果要刪除學生的信息請輸入1!n如果不需要刪除學生的信息請輸入2!b;switch(b)case 1: cout輸入要

20、刪除信息學生的學號:data; if(h=0)coutxh=data) p2=h;h=h-next; delete p2;cout成功刪除學生的信息!endl; else p2=p1=h; while(*p2).xh!=data&(*p2).next!=0) p1=p2; p2=(*p2).next; if(*p2).xh=data) (*p1).next=(*p2).next; delete p2;cout成功刪除學號為data學生的信息endl; else cout沒有找到要刪除的信息; case 2:break;void score(STU *h,int n)STU *p; char x

21、m2020,xb2020,jg2020,b20,c20,d20;double s20,xh20,vc20,english20,physics20,S,a,e,f,g; p=h; for(int i=0;in;i+)si=(*p).c*4.5+(*p).eng*4+(*p).phy*3)/11.5-50)/10; xhi=(*p).xh;strcpy(xmi,(*p).xm);strcpy(xbi,(*p).xb);strcpy(jgi,(*p).jg);vci=(*p).c;vci=(*p).c;physicsi=(*p).phy; p=(*p).next; for(i=0;in-1;i+)f

22、or(int j=i+1;jn;j+)if(si=sj)S=si;si=sj;sj=S; a=xhi;xhi=xhj;xhj=a;strcpy(b,xmi); strcpy(xmi,xmj);strcpy(xmj,b);strcpy(c,xbi); strcpy(xbi,xbj);strcpy(xbj,c);strcpy(d,jgi); strcpy(jgi,jgj);strcpy(jgj,d);e=vci; vci=vcj;vcj=e;f=englishi;englishi=englishj; englishj=f;g=physicsi;physicsi=physicsj;physicsj=

23、g;for(i=0;in;i+)coutxhitxmitsin; cout特等獎學金名單:n; for(i=0;i=4.0)coutxmin; cout一等獎學金名單:n; for(i=0;i=3.6&si4.0) coutxmin; cout二等獎學金名單:n; for(i=0;i=3.2&si3.6)coutxmin; cout三等獎學金名單:n; for(i=0;i=2.8&si3.2)coutxmin;void goodstudent(STU *h,int n) double s20; char XM2020; long int XH20; STU *p; p=h; for(int i

24、=0;in;i+)si=(*p).c*4.5+(*p).eng*4+(*p).phy*3)/11.5-50)/10;strcpy(XMi,(*p).xm);XHi=(*p).xh;p=(*p).next; cout三好學生的名單:n; for(i=0;i=3.0|si3.5&(*p).c-50)/10)=1.0&(*p).c-50)/10)3.5&(*p).eng-50)/10)=1.0&(*p).eng-50)/10)3.5&(*p).phy-50)/10)=1.0&(*p).phy-50)/10)=2.0) coutXHitXMitsin;void helpandabout()cout關于

25、:n;cout 本程序為學生成績管理系統(tǒng),可實現(xiàn)對班級學生的成績的管理及獎學金、三好生的評定工作,具備查詢和檢索等功能。endl;void welcome()cout * n;cout * * n;cout * 歡迎進入江蘇科技大學學生管理系統(tǒng)! * n;cout * * n;cout * n;void main() STU *h; long int data; int n,a,r,m; BJ xg12; xg12.welcome(); xg12.helpandabout(); do coutn請選擇要操作的內容!n; cout要輸入學生的信息請輸入1!endl; cout要查詢學生的信息請輸

26、入2!endl; cout要輸出學生的信息請輸入3!endl; cout對學生的信息進行排序請輸入4!endl; cout要刪除某學生的信息請輸入5!r; switch(r) case 1: cout請輸入班級人數(shù)!endln; coutendl; cout請輸入班級學生信息!endl; h=xg12.create(n); break; case 2: xg12.search(h); break; case 3: xg12.print(h); xg12.count(h,n); xg12.score(h,n); xg12.goodstudent(h,n); break; case 4: xg12.sort(h,a,n); break; ca

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論