課程設(shè)計報告書(學(xué)生成績管理系統(tǒng))_第1頁
課程設(shè)計報告書(學(xué)生成績管理系統(tǒng))_第2頁
課程設(shè)計報告書(學(xué)生成績管理系統(tǒng))_第3頁
課程設(shè)計報告書(學(xué)生成績管理系統(tǒng))_第4頁
課程設(shè)計報告書(學(xué)生成績管理系統(tǒng))_第5頁
已閱讀5頁,還剩19頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、計算機(jī)應(yīng)用技術(shù)系課程設(shè)計報告書C+語言程序設(shè)計題目: 學(xué)生成績管理系統(tǒng) 班級: 1101111 學(xué)號: 110111104 姓名: 田恬 指導(dǎo)教師: 王家寧 周期: 20127-22012-76 成績: 年 月 日一、課程設(shè)計的目的與要求 (一)課程設(shè)計目的與任務(wù)通過本課程設(shè)計的實踐,全面總結(jié)C+課程學(xué)習(xí)中的的數(shù)據(jù)類型、程序結(jié)構(gòu)、數(shù)組、函數(shù)、指針、結(jié)構(gòu)體等基本概念,掌握其使用方法。掌握面向?qū)ο蟪绦蛟O(shè)計中有關(guān)類、對象、繼承、重載、多態(tài)性、輸入輸出流類體系、文件操作的基本概念,初步學(xué)會用類與對象這種面向?qū)ο蟮某绦蛟O(shè)計方法編寫應(yīng)用程序。培養(yǎng)使用面向?qū)ο蟮某绦蛟O(shè)計方法編寫計算機(jī)程序的能力。(二)題目要

2、求 1)依次錄入學(xué)生信息:學(xué)號,班級,姓名,科目,成績并生成一個.txt文件。 2)可根據(jù)學(xué)號查詢該學(xué)生的相關(guān)成績。也可根據(jù)科目查詢所有學(xué)生該課的成績. 3)可以查詢某門課成績在某一范圍內(nèi)的學(xué)生的相關(guān)信息,如:物理成績在5060之間。 4)可添加或刪除某個學(xué)生的相關(guān)信息.二、設(shè)計正文1、系統(tǒng)分析(1)學(xué)生信息錄入功能 1)用戶從鍵盤輸入每個學(xué)生的信息:學(xué)號、姓名、性別、數(shù)學(xué)、英語、政治、程序設(shè)計基礎(chǔ)、物理五門課成績。 2)可插入一個或多個學(xué)生信息到當(dāng)前編輯的班級數(shù)據(jù)中。3) 可刪除一個或多個學(xué)生信息。(2)文件保存功能 1)學(xué)生信息每一班存為一個數(shù)據(jù)文件,數(shù)據(jù)文件可在程序中打開、編輯和重新保存

3、。 2)用戶輸入學(xué)生信息可隨時保存數(shù)據(jù)文件。(3)文件打開功能 1)程序只能對當(dāng)前打開的數(shù)據(jù)文件進(jìn)行編輯。(4)查詢功能 1)瀏覽所有學(xué)生信息; 2)按學(xué)號查詢學(xué)生信息; 3)按姓名查詢學(xué)生信息; 4) 查詢一個班總成績和平均成績; 5) 查詢一個班某一門課總成績和平均成績; 6)查詢某一門課分?jǐn)?shù)段( 60,6069,70-79,80-89,90)學(xué)生數(shù).(5)報表輸出功能 1) 按學(xué)號輸出一個班學(xué)生信息:學(xué)號、姓名、性別、數(shù)學(xué)、英語、政治、程序設(shè)計基礎(chǔ)、物理成績和總成績,到屏幕和文件。 2) 按總成績輸出從高到低輸出學(xué)號、姓名信息。 注:以上功能以菜單形式供用戶使用,并有一定的容錯功能。2.

4、功能詳細(xì)描述及框圖:1)輸入模塊 用戶據(jù)菜單提示結(jié)合自己的需求輸入一個011的值,來實現(xiàn)一定的功能。信息錄入模塊 此模塊可以讓用戶從鍵盤輸入每個學(xué)生的信息:學(xué)號、姓名、性別、數(shù)學(xué)、英語、政治、程序設(shè)計基礎(chǔ)、物理五門課成績。用戶可插入一個或多個學(xué)生信息到當(dāng)前編輯的班級數(shù)據(jù)中. 用戶可刪除一個或多個學(xué)生信息。保存功能模塊 用戶在確定以錄入的成績無誤之后,可以將學(xué)生信息以每一班為單位存為一個數(shù)據(jù)文件.用戶輸入的學(xué)生信息可隨時保存數(shù)據(jù)文件。4打開功能模塊 用戶可以用此模塊將數(shù)據(jù)文件在程序中打開、編輯,程序只能當(dāng)前打開的數(shù)據(jù)文件進(jìn)行編輯。功能模塊 此模塊里,用戶可實現(xiàn)以下操作:1。瀏覽所有學(xué)生信息;2.

5、按學(xué)號查詢學(xué)生信息;3。按姓名查詢學(xué)生信息;4。查詢一個班每個人的總成績和平均成績; 5.查詢一個班某一門課每個人的總成績和平均成績;6)進(jìn)行成績的統(tǒng)計分析:包括總?cè)藬?shù),每門課的最高成績、最低成績、平均成績、各個分?jǐn)?shù)段的人數(shù)(10090、8980、79-70、6960、59-50、50以下)、及格人數(shù).6)輸出功能模塊 在此模塊中,用戶可以瀏覽所有學(xué)生的信息,或者可以按學(xué)號輸出一個班學(xué)生信息:學(xué)號、姓名、性別、數(shù)學(xué)、英語、政治、程序設(shè)計基礎(chǔ)、物理成績和總成績,到屏幕和文件。也可以按總成績輸出從高到低輸出學(xué)號、姓名信息。 系統(tǒng)功能框圖如下: 學(xué)生成績管理 數(shù)據(jù)增加成績排名數(shù)據(jù)修改數(shù)據(jù)刪除數(shù)據(jù)查詢

6、數(shù)據(jù)錄入平均分排名總成績排名姓名查詢學(xué)號查詢 執(zhí)行流程圖如下:開始m值1,3,4值8值9值7,2,6,5值10,11文件保存功能模塊學(xué)生信息錄入模塊文件打開查詢功能報表輸出用戶輸入,并將值保存至m中m結(jié)束數(shù)據(jù)庫設(shè)計主要功能邏輯過程和實現(xiàn)算法 1)生成.txt文件的算法: cout”n 輸入1。將上述信息保存成文件; 輸入0:返回endl;cinm;if (m=1)cout”請輸入文件名:”file;cout”請輸入班級名稱:”classname;output.open(file);outputclassname”成績單”endlsetw(8)學(xué)號”setw(8)” 姓名setw(6)”性別se

7、tw(6)數(shù)學(xué)”setw(6)”英語”setw(6)”政治setw(14)程序設(shè)計基礎(chǔ)setw(6)物理”setw(8)總成績setw(10)”平均成績”endl;for(j=0;ji;j+)outputsetw(8)stuj.idsetw(8)stuj。namesetw(6)stuj。sexsetw(6)stuj。grade0setw(6)stuj。grade1setw(6)stuj。grade2setw(14)stuj。grade3setw(6)stuj.grade4setw(8)stuj.sumsumsetw(10)stuj。averageendl;output。close();brea

8、k;2) 部分主函數(shù)體: void main() stucopy stuM;stucopy stutemp;list will;student p, *p1=new student(),q;ifstream input;ofstream output;char file20,classname20,temp80,id20,name9,sex110;int m=0,n=0,j=0,i=0;double grade15;for(i=0;i20;i+) idi=0;for(i=0;iinclude#includeconst int M = 20;class stucopy/此類用于拷貝student

9、的數(shù)據(jù),用于排序功能的實現(xiàn)public:char id20;char sex10;char name10;double grade5;double sumsum;/總成績double average;/平均成績;class student/用于保存學(xué)生信息的類friend class list;public:char id20;/保存學(xué)號char sex10;/保存性別char name10;/保存名字double grade5;/保存成績student()next=0;for (int i=0;i20;i+)idi=0;for (i=0;i10;i+)sexi=0;for (i=0;i10;

10、i+)namei=0;void s();void setid(char id120)for(int i=0;i20;i+)idi=id1i;void setsex(char sex110)for(int i=0;i10;i+)sexi=sex1i;void setname(char name110)for(int i=0;i10;i+)namei=name1i;void setgrade(double grade15)for(int i=0;i5;i+)gradei=grade1i;student *next;/next指向下一個學(xué)生,構(gòu)成鏈表char outid()return id;cha

11、r * outsex()return sex;char * outname()return name;;double outsum()double sum=0;for(int i=0;ioutgrade(i);return sum;double outav()return this-outsum()/5;double outgrade(int i)return gradei;void intgrade(int);void student:intgrade(int j)/用于修改學(xué)生的成績 switch (j)case 1: cout” 請輸入數(shù)學(xué)成績:n”; cingrade0;break;c

12、ase 2: coutgrade1;break;case 3: coutgrade2;break;case 4: cout請輸入程序設(shè)計基礎(chǔ)成績:n; cingrade3;break;case 5: coutgrade4;break;void student::s()/用于錄入學(xué)生的信息cout”請輸入學(xué)號:n”;cinid;coutname;cout請輸入性別:n”;cinsex;cout請輸入數(shù)學(xué)成績:n;cingrade0;coutgrade1;cout”請輸入政治成績:n”;cingrade2;coutgrade3;coutgrade4;class list/此類為鏈表private:

13、double high5,low5;public:student *last,*first;/鏈表的開頭和結(jié)尾double totoal;list()last=0;first=0;list();void instu();/新建一個學(xué)生的數(shù)據(jù)void outstu(char );/根據(jù)姓名輸出一個學(xué)生的信息int delstu(char n);/根據(jù)姓名刪除一個學(xué)生的信息void outstu1(char );/根據(jù)學(xué)號輸出一個學(xué)生的信息int delstu1(char n);/根據(jù)學(xué)號刪除一個學(xué)生的信息void outsum(char *);/根據(jù)姓名輸出一個學(xué)生的總成績和平均成績void o

14、utsum1(char *);/根據(jù)學(xué)號輸出一個學(xué)生的總成績和平均成績void think();/用于輸出班級成績的統(tǒng)計分析void search(char s10,int);/根據(jù)姓名修改一個學(xué)生的成績void search1(char s20,int);/根據(jù)學(xué)號修改一個學(xué)生的成績double hi(int i);/求某門課的最高分double lo(int i);/求某門課的最低分void av(int i);/求某門課的平均分void ev(int i);/用于班級成績統(tǒng)計分析的人數(shù)分布輸出void scanall();/輸出所有學(xué)生的信息;list::list()/析構(gòu)函數(shù),將所有創(chuàng)

15、建的學(xué)生對象刪掉if(first!=0)student p=first,*temp;while(p!=NULL)temp=p;p=pnext;delete temp;coutokn;void list:instu() student p=new student();ps();if(first=0)first=last=p;elselastnext=p;last=p;void list::outstu(char *n)if(first=0) coutnext)if(strcmp(temp-outname(),n)=0) coutsetw(8)學(xué)號”setw(8)”姓名”setw(6)”性別set

16、w(6)數(shù)學(xué)setw(6)”英語”setw(6)”政治setw(14)程序設(shè)計基礎(chǔ)setw(6)物理”endl;coutsetw(8)tempoutid()setw(8)tempoutname()setw(6)outsex()setw(6)temp-outgrade(0)setw(6)outgrade(1)setw(6)temp-outgrade(2)setw(14)tempoutgrade(3)setw(6)outgrade(4);return;cout”查無此人!endl;return;void list:outstu1(char n)if(first=0) cout”班級無成員!查無此人

17、!next)if(strcmp(tempoutid(),n)=0) coutsetw(8)”學(xué)號”setw(8)”姓名”setw(6)”性別setw(6)”數(shù)學(xué)setw(6)”英語setw(6)”政治”setw(14)程序設(shè)計基礎(chǔ)”setw(6)”物理endl;coutsetw(8)temp-outid()setw(8)temp-outname()outsex()setw(6)tempoutgrade(0)setw(6)temp-outgrade(1)setw(6)tempoutgrade(2)outgrade(3)setw(6)outgrade(4);return;cout查無此人!”end

18、l;return;int list::delstu(char n)if(first=0) coutnext;delete temp;coutnext)if(strcmp(temp-next-outname(),n)=0)p=temp-next;tempnext=temp-next-next;delete p;cout”n刪除成功n”;return 0;coutn查無此人,刪除失敗n;return 0;int list::delstu1(char n)if(first=0) cout”無數(shù)據(jù)!”outid(),n)=0) first=first-next;delete temp;coutnext

19、!=NULL)if(strcmp(temp-next-outid(),n)=0)p=tempnext;temp-next=tempnext-next;delete p;cout”n刪除成功n”;return 0;else temp=tempnext;cout”n查無此人,刪除失敗n;return 0;void list::think()if(first=0) cout無數(shù)據(jù)!endl;return; int i=0;student p=first;while (p!=NULL)p=p-next;i+;totoal=i;cout”人數(shù):”iendl;cout數(shù)學(xué)n;cout”最高分:hi(0)”

20、 ”最低分:lo(0) ”平均分:;av(0);ev(0);cout英語n;cout”最高分:hi(1) ”最低分:”lo(1) ”平均分:”;av(1);ev(1);cout”政治n;cout最高分:”hi(2)” ”最低分:lo(2)” ”平均分:”;av(2);ev(2);cout程序設(shè)計基礎(chǔ)n”;cout”最高分:”hi(3) 最低分:”lo(3)” 平均分:;av(3);ev(3);cout物理n;cout最高分:”hi(4) ”最低分:lo(4) highi)highi=temp-outgrade(i);temp=temp-next;return highi;double list

21、:lo(int i)lowi=100;student *temp=first;while(temp!=0)if(temp-outgrade(i)outgrade(i);temp=tempnext;return lowi;void list:av(int i)double aver=0;student *temp=first;while(temp!=NULL)aver+=tempoutgrade(i);temp=tempnext;coutnext;cout10090的人數(shù):”a” 8980的人數(shù):b” 7970的人數(shù):”c 69-60的人數(shù):”d 5950的人數(shù):”e” 50以下的人數(shù):f 及格

22、的人數(shù):”(a+b+c+d) 不及格的人數(shù):”outname(),s)=0)temp-intgrade(n);void list::search1(char s20,int n)student *temp=first;for(;temp!=NULL;temp=temp-next)if(strcmp(tempoutid(),s)=0)tempintgrade(n);void list::outsum(char *n)if(first=0) cout”無數(shù)據(jù)!”endl;return;student *temp=first;for(;temp!=NULL;temp=temp-next)if(str

23、cmp(temp-outname(),n)=0)coutsetw(8)學(xué)號setw(8)”姓名”setw(8)性別setw(8)”總成績setw(10)”平均成績”n;coutoutid()setw(8)temp-outname()setw(8)outsex()outsum()setw(10)temp-outav();return;cout”查無此人!endl;return;void list:outsum1(char n)double sum=0;int i=0;double av=0;if(first=0) cout”無數(shù)據(jù)!next)if(strcmp(temp-outid(),n)=0

24、)coutsetw(8)”學(xué)號setw(8)”姓名”setw(8)”性別”setw(8)總成績”setw(10)”平均成績”n;coutsetw(8)tempoutid()outname()setw(8)outsex()setw(8)tempoutsum()outav();return;cout”查無此人!”next)coutsetw(8)outid()setw(8)temp-outname()setw(6)outsex()setw(6)tempoutgrade(0)setw(6)temp-outgrade(1)setw(6)outgrade(2)outgrade(3)setw(6)tempo

25、utgrade(4)setw(8)tempoutsum()setw(10)temp-outav()endl;void main()stucopy stuM;/復(fù)制整個鏈表的數(shù)據(jù)于數(shù)組,用于排序stucopy stutemp;/臨時變量list will;/整個鏈表student *p, p1=new student(),q;/臨時變量ifstream input;/輸入ofstream output;/輸出char file20,classname20,temp80,id20,name9,sex110;/臨時變量int m=0,n=0,j=0,i=0;/臨時變量double grade15;/

26、臨時變量for(i=0;i20;i+) idi=0;for(i=0;i9;i+) namei=0;/初始化docout”/-n” 0、 退出系統(tǒng)。n 1、 成績的錄入:包括學(xué)生學(xué)號、姓名、性別和各門課程成績的錄入。n” 2、 成績的查詢:可以根據(jù)學(xué)號或姓名查詢某個學(xué)生的成績。n” 3、 成績的修改:可以根據(jù)學(xué)號或姓名來修改相應(yīng)的學(xué)生的成績。n 4、 數(shù)據(jù)的刪除:可以根據(jù)學(xué)號或姓名指定刪除某個學(xué)生的數(shù)據(jù).n 5、 成績的統(tǒng)計分析:包括總?cè)藬?shù)、最高成績、最低成績、平均成績、n” 各個分?jǐn)?shù)段的人數(shù)(100-90、8980、7970、69-60、59-50、50以下)、及格率.n” 6、 總成績和平均

27、成績的查詢:可以根據(jù)學(xué)號或姓名查詢。n 7、 瀏覽所有學(xué)生信息。n” 8、 將所有學(xué)生信息保存成文件。n” 9、 打開指定的數(shù)據(jù)文件。n” 10、 按總成績排序輸出學(xué)生信息。n 11、 按學(xué)號順序輸出學(xué)生信息,并可保存成文件。n”/-n”;coutendl”請輸入:;cinm;switch(m)case 1:will.instu();break;case 2:cout1.根據(jù)學(xué)號查詢 2。根據(jù)姓名查詢endl”請輸入:”;cinn;switch(n)case 1:coutid;will。outstu1(id);cout”n;break;case 2:coutname;will.outstu(n

28、ame);coutn;break;break;case 3:cout1.根據(jù)學(xué)號查詢 2.根據(jù)姓名查詢n;switch(n)case 1:cout”請輸入學(xué)號n”;cinid;will。outstu1(id);coutn”;coutsetw(6)1.數(shù)學(xué)setw(6)2.英語setw(6)3。政治 setw(14)4.程序設(shè)計基礎(chǔ)”setw(6)j;will。search1(id,j);break;case 2:coutname;will。outstu(name);cout”n”;coutsetw(6)1.數(shù)學(xué)setw(6)”2。英語setw(6)3。政治 setw(14)”4.程序設(shè)計基礎(chǔ)”

29、setw(6)5。物理”endl;cout”請輸入課程編號:”;cinj;will。search(name,j);break;break;case 4:cout1。根據(jù)學(xué)號刪除 2。根據(jù)姓名刪除endln;switch(n)case 1:coutid;will.outstu1(id);will.delstu1(id);break;case 2:cout”請輸入姓名n”;cinname;will.outstu(name);will。delstu(name);break;break;case 5:will.think();break;case 6:cout1.根據(jù)學(xué)號查詢 2.根據(jù)姓名查詢endl

30、n;switch(n)case 1:coutid;will.outsum1(id);break;case 2:cout”請輸入姓名n;cinname;will.outsum(name);break;break;case 7:coutsetw(8)學(xué)號”setw(8)”姓名setw(6)”性別”setw(6)數(shù)學(xué)”setw(6)”英語”setw(6)”政治setw(14)程序設(shè)計基礎(chǔ)setw(6)物理setw(8)”總成績”setw(10)”平均成績n;will。scanall();break;case 8:cout請輸入文件名:file;coutclassname;output.open(fi

31、le);p = will。first;outputclassname”成績單”endlsetw(8)”學(xué)號”setw(8)”姓名”setw(6)性別setw(6)數(shù)學(xué)”setw(6)”英語setw(6)政治setw(14)程序設(shè)計基礎(chǔ)setw(6)物理”setw(8)總成績setw(10)平均成績”endl;for(;p!=NULL;p=pnext)outputsetw(8)outid()setw(8)p-outname()setw(6)poutsex()setw(6)outgrade(0)outgrade(1)setw(6)p-outgrade(2)setw(14)p-outgrade(3)

32、setw(6)outgrade(4)setw(8)outsum()setw(10)p-outav()endl;output。close();break;case 9:cout請輸入文件名:”endl;cinfile;input。open(file);if (input.fail())cout”File does not existendl;break;input.getline(temp,80);input.getline(temp,80);if(input.eof() cout文件中無數(shù)據(jù)!”idnamesex1grade10grade11grade12grade13grade14;inpu

33、ttemp;inputtemp;/將總成績和平均成績輸入進(jìn)臨時變量p1setid(id);p1-setname(name);p1setsex(sex1);p1-setgrade(grade1);will。first=p1;will。last=will.first;while(!input.eof())p=new student();q=will。last; will.last-next=p;will。last=p;inputidnamesex1grade10grade11grade12grade13grade14;will.lastsetid(id);will.last-setname(nam

34、e);will。last-setsex(sex1);will。lastsetgrade(grade1);inputtemp;inputtemp;/將總成績和平均成績輸入進(jìn)臨時變量will。last=q;will.lastnext=NULL;input.close();break;case 10:p=will。first;for(i=0;i20&p!=NULL;i+,p=p-next)for (j=0;j20;j+)stui.idj=pidj;for (j=0;jnamej;for (j=0;jsexj;stui。sumsum=p-outsum();stui.average=poutav();for(n=0;ni-1;n+)for(j=1;ji;j+)if (stun。sumsumstuj.sumsum)stutemp=stuj;stuj=stun;stun=stutemp;coutsetw(8)”學(xué)號setw(8)姓名”set

溫馨提示

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

最新文檔

評論

0/150

提交評論