c學生成績管理系統(tǒng)_第1頁
c學生成績管理系統(tǒng)_第2頁
c學生成績管理系統(tǒng)_第3頁
c學生成績管理系統(tǒng)_第4頁
c學生成績管理系統(tǒng)_第5頁
已閱讀5頁,還剩14頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、面向對象程序設計報告書項目名稱:學生成績管理系統(tǒng)班級:09自動化一班姓名:蔡晴,彭俊瑋,方甜蓮,曾穆英學號:0904020129,0904020111, 0904020130,0904020129完成時間:成績:指導老師簽名:時間:系統(tǒng)說明書1 問題描述通過本學生成績管理系統(tǒng),可實現(xiàn)對學生姓名,學號,成績與課程(英語,線代,體育,馬克思,復變,電路)的錄入,學生成績及課程信息用文件保存。能按學號完成對學生成績的錄入,修改,能按學號與班級統(tǒng)計學生的成績,求得學生成績的總分,平均分,積點,平均績點并且進行高低排序,能查詢學生成績,按學號輸出學生的成績單。2 類體系設計和程序流程圖3 主要數(shù)據(jù)及函數(shù)

2、功能描述函數(shù)基本功能包括:1輸入數(shù)據(jù):根據(jù)學生的學號,課程輸入該學生的成績;2增加數(shù)據(jù):當增加新的學生成績時,可以實現(xiàn)增加成績的錄入;3修改數(shù)據(jù):當學生成績發(fā)生改變時,可以對該學生的成績信息進行修改;4刪除學生的信息:當學生成績錄入錯誤時,可以刪去該信息;5按姓名查詢:可以按姓名查詢該生成績;6按學號查詢:可以按學號查詢該生成績;7輸出所有學生成績:可以對輸入的所有學生的成績進行查詢; 8按總分高低排序:可按學生成績的高低進行排序并顯示;9保存文件:可以實現(xiàn)對學生數(shù)據(jù)的保存;10退出系統(tǒng) 。 主要數(shù)據(jù)包括:學生姓名,學號,各科目成績,總成績,平均成績,平均績點,績點。獲取課程信息查看考試成績課

3、程名稱考試成績總分平均分積點平均績點成績獲取課程信息C+英語線代體育馬克思復變電路課程選擇課程獲取課程信息姓名學號學生類圖的繪制參加考試獲取考試信息查看考試成績姓名學號學生 4 擬采用開發(fā)平臺Visual c+程序代碼:#include<iostream.h>#include<string.h>#include<fstream.h>#include<stdlib.h>#include<iomanip.h> class student private: char name4; /姓名 double cpro,english,math,s

4、port,marx,hbpro,circuit,allscore,average,averagecore,core;/課程 int order, number; /名次,學號 public: student() student(char n4,int nu,double cc,double eng,double ma,double sp,double l,double hb,double com,double as,double av,double c1,double ac) strcpy(name,n); number=nu; cpro=cc; english=eng;math=ma;spo

5、rt=sp;marx=l;hbpro=hb;circuit=com;allscore=as;average=av;core=c1;averagecore=ac; friend void main(); ;void main() double allscore; double average; double averagecore; cout<<" 歡迎使用學生管理系統(tǒng)"<<endl; cout<<" *"<<endl; cout<<" * 學生成績管理系統(tǒng) *"<<

6、;endl; cout<<" *"<<endl; cout<<" 0、輸入數(shù)據(jù) "<<endl; cout<<" 1、增加數(shù)據(jù) "<<endl; cout<<" 2、修改數(shù)據(jù) "<<endl; cout<<" 3、刪除學生的信息 "<<endl; cout<<" 4、按姓名查詢 "<<endl; cout<<"

7、5、按學號查詢 "<<endl; cout<<" 6、輸出所有學生成績 "<<endl; cout<<" 7、按總分高低排序 "<<endl; cout<<" 8、保存文件 "<<endl; cout<<" 9、退出系統(tǒng) "<<endl; cout<<" ="<<endl; cout<<" 選擇0-9數(shù)字進行操作"<&

8、lt;endl; cout<<" ="<<endl; char p;char w; student s50; /指針對象,最多存50個學生數(shù)據(jù) ofstream *file50; /負責對文件插入操作 int i=0; int j=0; int flag=0;do /flag判斷輸入是否有效 cin>>p;if(p>='0'&&p<='9') flag=1;else cout<<" 指令錯誤!請重新輸入:"<<endl; while(f

9、lag=0);do switch(p) /接收功能選項 case '0': /輸入數(shù)據(jù) char c; char name4;int number;double cpro,english,math,sport,marx,hbpro,core,circuit; do cout<<endl<<" 姓名:" cin>>name; cout<<endl<<" 學號:" cin>>number; cout<<endl<<" C+成績:"

10、; cin>>cpro; cout<<endl<<" 英語成績:" cin>>english; cout<<endl<<" 線代成績:" cin>>math; cout<<endl<<" 體育成績:" cin>>sport; cout<<endl<<" 馬克思成績:" cin>>marx; cout<<endl<<" 復變成績:

11、" cin>>hbpro; cout<<endl<<" 電路成績:" cin>>circuit; cout<<endl; allscore=cpro+english+math+sport+marx+hbpro+circuit; cout<<" 總成績:"<<allscore<<endl; average=(cpro+english+math+sport+marx+hbpro+circuit)/7; cout<<" 平均成績:&q

12、uot;<<average<<endl; core=(1+(cpro-60.00)/10)*3.5+(1+(english-60.00)/10)*5+(1+(math-60.00)/10)*4+(1+(sport-60.00)/10)*2+(1+(marx-60.00)/10)*2+(1+(hbpro-60.00)/10)*1.5+(1+(circuit-60.00)/10)*2; cout<<" 積點:"<<core<<endl; averagecore=core/20; cout<<" 平

13、均積點:"<<averagecore<<endl; filej=new ofstream("D:student.dat",ios:ate); *filej<<" 姓名 "<<name<<" 學號 "<<number<<" C+成績 "<<cpro <<" 英語成績 "<<english<<" 線代成績 "<<math<

14、<" 體育成績 " <<sport<<" 馬克思成績 "<<marx<<" 復變成績 "<<hbpro<<"電路成績 "<<circuit<<"總成績"<<allscore<<"平均成績"<<average<<"積點"<<core<<"平均積點"<<av

15、eragecore<<endl; j+; si= student(name, number,cpro,english,math,sport,marx,hbpro,circuit,allscore,average,core,averagecore); i+; cout<<" 數(shù)據(jù)輸入成功,想繼續(xù)輸入嗎(y/n):" cin>>c; cout<<endl;do if(c!='y'&&c!='n') cout<<" 指令錯誤!請重新輸入!"<<

16、;endl<<" " cin>>c; else flag=1; while(flag=0); while(c='y');break; case '1': /增加數(shù)據(jù) char name20; int number;double cpro,english,math,sport,marx,hbpro,circuit,core,averagecore; char c; do cout<<" 請輸入您要增加的學生的姓名:" cin>>name; cout<<endl<

17、;<" 學號:" cin>>number; cout<<endl<<" C+成績:" cin>>cpro; cout<<endl<<" 英語成績:" cin>>english; cout<<endl<<" 線代成績:" cin>>math; cout<<endl<<" 體育成績:" cin>>sport; cout<<end

18、l<<" 馬克思成績:" cin>>marx; cout<<endl<<" 復變成績:" cin>>hbpro; cout<<endl<<" 電路成績:" cin>>circuit; cout<<endl; allscore=cpro+english+math+sport+marx+hbpro+circuit; cout<<" 總成績:"<<allscore<<endl;

19、average=(cpro+english+math+sport+marx+hbpro+circuit)/7; cout<<" 平均成績:"<<average<<endl; core=(1+(cpro-60.00)/10)*3.5+(1+(english-60.00)/10)*5+(1+(math-60.00)/10)*4+(1+(sport-60.00)/10)*2+(1+(marx-60.00)/10)*2+(1+(hbpro-60.00)/10)*1.5+(1+(circuit-60.00)/10)*2; cout<<&

20、quot; 積點:"<<core<<endl; averagecore=core/20; cout<<" 平均積點:"<<averagecore<<endl; filej=new ofstream("d:student.dat",ios:ate); *filej<<" 姓名 "<<name<<" 學號 "<<number<<" C+成績 "<<cpro&l

21、t;<" 英語成績 "<<english<<" 線代成績 "<<math<<" 體育成績 "<<sport<<" 馬克思成績 "<<marx<<" 復變成績 "<<hbpro<<" 電路成績 "<<circuit<<" 總成績 "<<allscore<<" 平均成績 &quo

22、t;<<average<<" 積點 "<<core<<" 平均積點 "<<averagecore<<endl; j+; si= student(name, number,cpro,english,math,sport,marx,hbpro,circuit,allscore,average,core,averagecore); i+; cout<<" 數(shù)據(jù)輸入成功,想繼續(xù)數(shù)入嗎(y/n):" cin>>c; cout<<endl;

23、 if(c!='y'&&c!='n') cout<<" 指令錯誤!請重新輸入!"<<endl<<" " cin>>c; while(c='y'); break; case '2': /修改數(shù)據(jù) char name20;int nu;double cc,eng,ma,sp,l,hb,com,as,av,c1,ac;flag=0; char c; if(i=0) cout<<"系統(tǒng)中找不到這個學生"

24、do cout<<" 請輸入您要修改的學生的姓名:" cin>>name; cout<<endl; for(int h=0;h<i;h+) /h紀錄要修改學生的位置 if(strcmp(name,)=0) flag=1; cout<<" 新的學號:" cin>>nu; cout<<endl<<" C+成績:" cin>>cc; cout<<endl<<" 英語成績:" cin&

25、gt;>eng; cout<<endl<<" 線代成績:" cin>>ma; cout<<endl<<" 體育成績:" cin>>sp; cout<<endl<<" 馬克思成績:" cin>>l; cout<<endl<<" 復變成績:" cin>>hb; cout<<endl<<" 電路成績:" cin>>co

26、m; as=cc+eng+ma+sp+l+hb+com; cout<<endl<<" 總成績:"<<as; av=as/7; cout<<endl<<" 平均成績:"<<av; c1=(1+(cc-60.00)/10)*3.5+(1+(eng-60.00)/10)*5+(1+(ma-60.00)/10)*4+(1+(sp-60.00)/10)*2+(1+(l-60.00)/10)*2+(1+(hb-60.00)/10)*1.5+(1+(com-60.00)/10)*2; cout&l

27、t;<" 積點:"<<c1<<endl; ac=c/20; cout<<" 平均積點:"<<ac<<endl; cout<<endl; sh.cpro=cc; sh.english=eng; sh.math=ma; sh.sport=sp; sh.marx=l; sh.hbpro=hb; sh.number=nu; cout<<" 數(shù)據(jù)修改成功!"<<endl; if(flag=0) cout<<" 您要修改的學

28、生本來就不存在!請檢查重新輸入!"<<endl; cout<<" 想繼續(xù)修改嗎(y/n):" cin>>c; cout<<endl; if(c!='y'&&c!='n') cout<<" 指令錯誤!請重新輸入!"<<endl<<" " cin>>c; while(c='y'); break; case '3': cout<<" 請

29、輸入你要刪除的姓名 :" char m20; cin>>m; for(int a=0;a<i;a+) if(strcmp(,m)=0) int w; w=a; for(w;w<i;w+) sw=sw+1; i=i-1; cout<<" 刪除成功!"<<endl; break; case '4': /按姓名查詢 char n20;int j=0;char c; if(i=0) cout<<" 管理系統(tǒng)中沒有輸入數(shù)據(jù)!"<<endl;break;

30、do int flag=0; cout<<" 請輸入你要查詢的學生姓名:" cin>>n; cout<<endl; for(int j=0;j<i;j+) if(strcmp(n,(sj).name)=0) flag=1; cout<<" 您要查詢的學生是:"<<(sj).name<<endl; cout<<(sj).name<<"的成績是: "<<" C+: "<<(sj).cpro<

31、;<" 英語: "<<(sj).english<<" 線代:"<<(sj).math<<" 體育:"<<(sj).sport<<" 馬克思:"<<(sj).marx<<" 復變:"<<(sj).hbpro<<" 電路 "<<(sj).circuit<<" 總成績"<<(sj).allscore&l

32、t;<" 平均成績"<<(sj).average<<" 積點"<<(sj).core<<" 平均積點"<<(sj).averagecore<<endl; if(flag=0) cout<<" 對不起!您要查詢的學生不存在!"<<endl; cout<<" 您想繼續(xù)查詢嗎?(y/n):" cin>>c; cout<<endl; if(c!='y'

33、&&c!='n') cout<<" 指令錯誤!請重新輸入!"<<endl; cin>>c; while(c='y'); break; case '5': /按學號查詢 int n,j=0;char c; if(i=0) cout<<" 管理系統(tǒng)中沒有輸入數(shù)據(jù)!"<<endl;break; do int flag=0; cout<<" 請輸入你要查詢的學生的學號:" cin>>n; cout

34、<<endl; for(int j=0;j<i;j+) if(sj.number=n) flag=1; cout<<" 您要查詢的學生是:"<<(sj).name<<endl; cout<<(sj).name<<"的成績是: "<<" C+:"<<(sj).cpro<<" 英語:"<<(sj).english<<" 線代:"<<(sj).math&

35、lt;<" 體育:"<<(sj).sport<<" 馬克思:"<<(sj).marx<<"復變:"<<(sj).hbpro<<" 電路: "<<(sj).circuit<<"總成績:"<<(sj).allscore<<"平均成績:"<<(sj).average<<" 積點"<<(sj).core&

36、lt;<" 平均積點"<<(sj).averagecore<<endl; if(flag=0) cout<<" 對不起!您要查詢的學生不存在!"<<endl; cout<<" 您想繼續(xù)查詢嗎?(y/n):" cin>>c; cout<<endl; if(c!='y'&&c!='n') cout<<" 指令錯誤!請重新輸入!"<<endl; cin>&

37、gt;c; while(c='y'); break; case '6': /輸出 cout<<" 本系統(tǒng)所有學生數(shù)據(jù)如下:"<<endl; if(i=0) cout<<" 管理系統(tǒng)中沒有輸入數(shù)據(jù)!"<<endl; cout<<"姓名 學號 c+ 英語 線代 體育 馬克思 復變 電路 總成績 平均成績 總積點 平均積點 "<<endl; for(int k=0;k<i;k+) cout<<<<

38、;setw(7)<<sk.number<<setw(4) <<(sk).cpro<<setw(5)<<(sk).english<<setw(5) <<(sk).math<<setw(4)<<(sk).sport<<setw(5) <<(sk).marx <<setw(5)<<(sk).hbpro<<setw(6)<<(sk).circuit<<setw(6)<<sk.allscore<&

39、lt;setw(10)<<(sk).average<<setw(7)<<(sk).core <<setw(8)<<(sk).averagecore<<setw(4)<<endl; break; case'7': student temp; for(int t=0;t<i;t+) for(int k=t+1;k<i;k+) while (st.allscore<sk.allscore) temp=st; st=sk; sk=temp; cout<<"已經排好

40、序了,是否需要輸出(y/n):" char yn; cin>>yn; while(yn!='y'&&yn!='n') cout<<"操作錯誤!請重新輸入:" cin>>yn; if(yn='y') cout<<"所有學生的成績按總分從高到低的排名是:"<<endl; cout<<" 本系統(tǒng)所有學生數(shù)據(jù)如下:"<<endl; if(i=0) cout<<" 管理系統(tǒng)中沒有輸入數(shù)據(jù)!"<<endl; cout<<"姓名 學號 c+ 英語 線代 體育 馬克思 復變 電路 總成績 平均成績 總積點 平均積點 "<<endl; for(int k=0;k&

溫馨提示

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

評論

0/150

提交評論