C語言課程設(shè)計(jì)-學(xué)生綜合測(cè)評(píng)系統(tǒng)_第1頁
C語言課程設(shè)計(jì)-學(xué)生綜合測(cè)評(píng)系統(tǒng)_第2頁
C語言課程設(shè)計(jì)-學(xué)生綜合測(cè)評(píng)系統(tǒng)_第3頁
C語言課程設(shè)計(jì)-學(xué)生綜合測(cè)評(píng)系統(tǒng)_第4頁
C語言課程設(shè)計(jì)-學(xué)生綜合測(cè)評(píng)系統(tǒng)_第5頁
已閱讀5頁,還剩18頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、課 程 設(shè) 計(jì) 報(bào) 告課程名稱 C語言程序設(shè)計(jì) 課題名稱 學(xué)生綜合測(cè)評(píng)系統(tǒng) 專 業(yè) 通信工程 班 級(jí) 1503 學(xué) 號(hào) , 姓 名 湯華貝,佘旭升,郭夢(mèng)婷,雍甜甜 指導(dǎo)教師 毛德梅 編寫 2016年6月 一、需求分析 一、問題描述:每個(gè)學(xué)生的信息為:學(xué)號(hào)、姓名、性別、家庭住址、聯(lián)系電話、語文、數(shù)學(xué)、外語三門單科成績(jī)、考試平均成績(jī)、考試名次、同學(xué)互評(píng)分、品德成績(jī)、任課教師評(píng)分、綜合測(cè)評(píng)總分、綜合測(cè)評(píng)名次??荚嚻骄煽?jī)、同學(xué)互評(píng)分、品德成績(jī)、任課教師評(píng)分分別占綜合測(cè)評(píng)總分的60%,10%,10%,20%。二、功能描述:A、學(xué)生信息處理(1) 輸入學(xué)生信息、學(xué)號(hào)、姓名、性別、家庭住址、聯(lián)系電話,按學(xué)

2、號(hào)以小到大的順序存入文件中。提示:學(xué)生信息可先輸入到數(shù)組中,排序后可寫到文件中。(2) 插入(修改)同學(xué)信息:提示:先輸入將插入的同學(xué)信息,然后再打開源文件并建立新文件,把源文件和輸入的信息合并到新文件中(保持按學(xué)號(hào)有序)若存在該同學(xué)則將新記錄內(nèi)容替換源內(nèi)容,(3) 刪除同學(xué)信息:提示:輸入將刪除同學(xué)號(hào),讀出該同學(xué)信息,要求對(duì)此進(jìn)行確認(rèn),以決定是否刪除將刪除后的信息寫到文件中。(4) 瀏覽學(xué)生信息:提示:打開文件,顯示該文件的學(xué)生信息。B、學(xué)生數(shù)據(jù)處理:(1) 按考試科目錄入學(xué)生成績(jī)并且按公式:考試成績(jī)(語文+數(shù)學(xué)+外語)/3 計(jì)算考試成績(jī),并計(jì)算考試名次,提示:先把學(xué)生信息讀入數(shù)組,然后按提

3、示輸入每科成績(jī),計(jì)算考試成績(jī),求出名次,最后把學(xué)生記錄寫入一個(gè)文件中。(2) 學(xué)生測(cè)評(píng)數(shù)據(jù)輸入并計(jì)算綜合測(cè)評(píng)總分及名次。提示:綜合測(cè)評(píng)總分(考試成績(jī))*0.6+(同學(xué)互評(píng)分)*0.1+品德成績(jī)*0.1+任課老師評(píng)分*0.2。(3) 學(xué)生數(shù)據(jù)管理提示:輸入學(xué)號(hào),讀出并顯示該同學(xué)信息,輸入新數(shù)據(jù),將改后信息寫入文件(4) 學(xué)生數(shù)據(jù)查詢:提示:輸入學(xué)號(hào)或其他信息,即讀出所有數(shù)據(jù)信息,并顯示出來。C、學(xué)生綜合信息輸出提示:輸出學(xué)生信息到屏幕。三、算法提示:1、數(shù)據(jù)結(jié)構(gòu):結(jié)構(gòu)體類型數(shù)組2、數(shù)據(jù)庫結(jié)構(gòu):下表構(gòu)成該系統(tǒng)的基本數(shù)據(jù)庫。 學(xué)號(hào)姓名考試成績(jī)?cè)u(píng)分CharCharstructint二總體設(shè)計(jì)方案1.總

4、體流程圖開始Welcome函數(shù)輸入瀏覽修改刪除瀏覽全部清除全部排名查詢排名退出初始化inti函數(shù)三程序源代碼 #include#include#define N 100void init();char welcome();void InputInfo();void view();void xiugai();void DeleteInfo();void paiming1(struct student_info student);void paiming2(struct student_info student);void ViewAll();void clean();void PaimingVi

5、ew();void exits();struct student_info input();void SortInfo(struct student_info student);void ViewInfo(struct student_info *sp);void SaveStruct(struct student_info *sp,int size,int n,char filename20);void LoadStruct(struct student_info *sp,int size,int n,char filename20);void SaveInt(int *p,int size

6、,int n,char filename20);void LoadInt(int *p,int size,int n,char filename20);int NumExist(struct student_info student,int num);struct student_info int num;/學(xué)號(hào)char name6;/姓名char sex5;/性別char adress20;/家庭住址char tel10;/電話int chinese,math,english,huping,pingde,jiaoping,paiming1,paiming2; /語文 數(shù)學(xué) 英語 互評(píng) 品德

7、教評(píng) double ave,zhongping;struct student_info studentN;int counter,PM; void main() char select;init(); /調(diào)用初始化函數(shù)while(1) select=welcome();switch(select)case 1:system(cls);InputInfo(); break; /選項(xiàng)1:輸入學(xué)生信息case 2:system(cls); view(); break; /選項(xiàng)2:瀏覽學(xué)生信息case 3:system(cls);xiugai(); break; /選項(xiàng)3:修改學(xué)生信息case 4:s

8、ystem(cls);DeleteInfo(); break; /選項(xiàng)4:刪除學(xué)生信息case 5:system(cls); paiming1(student);paiming2(student);PM=1;getchar();getchar();system(cls); break; /選項(xiàng)5:學(xué)生信息排名case 6: system(cls); ViewAll();break; /選項(xiàng)6:瀏覽全部學(xué)生信息case 7: system(cls); clean();break;/選項(xiàng)7:清除所有信息case 8: system(cls); PaimingView();break;/選項(xiàng)8:查詢

9、排名case 0:system(cls); exits(); break; /選項(xiàng)9:退出void init()FILE *fp;fp=fopen(counter.dat,rb);/打開計(jì)數(shù)變量counter文件if(fp!=NULL)/載入counterfclose(fp);LoadInt(&counter,sizeof(counter),1,counter.dat);elsefp=fopen(counter.dat,wb);/若沒有counter文件,則創(chuàng)建一個(gè),counter初始為0。fclose(fp);counter=0;if(counter!=0) /載入學(xué)生數(shù)據(jù)LoadStruc

10、t(student,sizeof(struct student_info),counter,student_info.dat);char welcome()char select;while(1)system(cls);printf(tt歡迎使用學(xué)生信息管理系統(tǒng) n);printf(n);printf(1.錄入學(xué)生信息 nn);printf(2.瀏覽學(xué)生信息 nn);printf(3.修改學(xué)生信息 nn);printf(4.刪除學(xué)生信息 nn);printf(5.排名學(xué)生成績(jī) nn);printf(6.瀏覽所有學(xué)生信息 nn);printf(7.清除所有數(shù)據(jù) nn);printf(8.查詢排名

11、 nn);printf(0.退出 nn);printf(輸入相應(yīng)的功能序號(hào):);select=getchar();if(select=1|select=2|select=3|select=4|select=5|select=6|select=7|select=8|select=0)return select;system(cls);continue;void InputInfo()int i,n;printf(需要錄入多少位學(xué)生的信息:);scanf(%d,&n);system(cls);for(i=1;i=n;i+)studentcounter=input();counter+;PM=0;S

12、ortInfo(student);SaveStruct(student,sizeof(struct student_info),counter,student_info.dat);SaveInt(&counter,sizeof(counter),1,counter.dat);void view()int i,num;printf(請(qǐng)輸入需要游覽的學(xué)生信息的學(xué)號(hào):);scanf(%d,&num);getchar();if(i=NumExist(student,num)=-1)printf(不存在該學(xué)號(hào),按回車鍵返回.);getchar();system(cls);return;ViewInfo(

13、&studenti);printf(n按回車鍵返回.);getchar();system(cls);return;void xiugai()int i,num;char YN,select;printf(請(qǐng)輸入需要修改的學(xué)生信息的學(xué)號(hào):);scanf(%d,&num);getchar();if(i=NumExist(student,num)=-1)printf(不存在該學(xué)號(hào),按回車鍵返回.);getchar();system(cls);return;ViewInfo(&studenti);printf(是否要修改?(Y/N):);scanf(%c,&YN);getchar();if(YN !=

14、Y& YN !=y)printf(修改取消.);getchar();system(cls);return;system(cls);printf(1.學(xué)號(hào) n);printf(2.性別 n);printf(3.家庭住址 n);printf(4.聯(lián)系電話 n);printf(5.語文成績(jī) n);printf(6.數(shù)學(xué)成績(jī) n);printf(7.外語成績(jī) n);printf(8.同學(xué)互評(píng)分 n);printf(9.品德成績(jī) n);printf(0.任課教師教師評(píng)分 n);scanf(%c,&select);switch(select)case 1:printf(修改學(xué)號(hào):);scanf(%d,&s

15、tudenti.num);break;case 2:printf(修改性別:);scanf(%s,&studenti.sex);break;case 3:printf(修改家庭住址:);scanf(%s,&studenti.adress);break;case 4:printf(修改聯(lián)系電話:);scanf(%s,&studenti.tel);break;case 5:printf(修改語文成績(jī):);scanf(%d,&studenti.chinese);break;case 6:printf(修改數(shù)學(xué)成績(jī):);scanf(%d,&studenti.math);break;case 7:pri

16、ntf(修改外語成績(jī):);scanf(%d,&studenti.english);break;case 8:printf(修改同學(xué)互評(píng)分:);scanf(%d,&studenti.huping);break;case 9:printf(修改品德成績(jī):);scanf(%d,&studenti.pingde);break;case 0:printf(修改任課教師評(píng)分:);scanf(%d,&studenti.jiaoping);break;SortInfo(student);SaveStruct(student,sizeof(struct student_info),counter,student

17、_info.dat);PM=0;getchar();printf(修改完成.);getchar();system(cls);void DeleteInfo()int i,j,num;char YN;printf(請(qǐng)輸入要?jiǎng)h除的學(xué)生信息學(xué)號(hào):);scanf(%d,&num);getchar();if(i=NumExist(student,num)=-1)printf(沒有該學(xué)號(hào),按回車鍵返回.);getchar();system(cls);return;ViewInfo(&studenti);printf(n確認(rèn)刪除(Y/N):);scanf(%c,&YN);getchar();if(YN!=Y

18、 & YN!=y)printf(刪除取消.);elsefor(j=i;jcounter-1;j+)studentj=studentj+1;counter-;PM=0;SaveStruct(student,sizeof(struct student_info),counter,student_info.dat);SaveInt(&counter,sizeof(counter),counter,counter.dat);printf(刪除完成.);getchar();system(cls);void paiming1(struct student_info student)struct stude

19、nt_info *pN,*temp;int i,j;for(i=0;icounter;i+)pi=&studenti;for(i=0;icounter-1;i+)for(j=i+1;jave ave)temp=pi;pi=pj;pj=temp;for(i=0;ipaiming1=i+1;printf(平均分排名完成.n);void paiming2(struct student_info student)struct student_info *pN,*temp;int i,j;for(i=0;icounter;i+)pi=&studenti;for(i=0;icounter-1;i+)for

20、(j=i+1;jzhongping zhongping)temp=pi;pi=pj;pj=temp;for(i=0;ipaiming2=i+1;printf(綜合測(cè)評(píng)分排名完成.n);void ViewAll()int i;for(i=0;inum);getchar();if(NumExist(student,sp-num)!=-1)printf(該學(xué)號(hào)已存在,請(qǐng)重新輸入.);getchar();system(cls);continue;break;printf(錄入姓名:);gets(sp-name);printf(錄入性別:);gets(sp-sex);printf(錄入家庭住址:);ge

21、ts(sp-adress);printf(錄入聯(lián)系電話:);gets(sp-tel);printf(n接下來錄入成績(jī)n);printf(語文:);scanf(%d,&sp-chinese);printf(數(shù)學(xué):);scanf(%d,&sp-math);printf(英語:);scanf(%d,&sp-english);sp-ave=(sp-chinese+sp-math+sp-english)/3.0;printf(同學(xué)互評(píng):);scanf(%d,&sp-huping);printf(品德分?jǐn)?shù):);scanf(%d,&sp-pingde);printf(教師評(píng)價(jià):);scanf(%d,&sp-

22、jiaoping);getchar();sp-zhongping=(sp-ave*0.6+sp-huping*0.1+sp-pingde*0.1+sp-jiaoping*0.2);printf(錄入完畢,確認(rèn)信息是否正確(Y/N);YN=getchar();getchar();if(YN=Y| YN=y)break;elseprintf(按回車鍵重新錄入信息。);getchar();system(cls);continue;system(cls);return stu;void SortInfo(struct student_info student)int i,j;struct studen

23、t_info temp;for(i=0;icounter-1;i+)for(j=i+1;j=counter-1;j+)if(studenti.numnum,sp-name,sp-sex,sp-adress,sp-tel);printf(語文t數(shù)學(xué)t英語t互評(píng)t品德t教評(píng)n);printf(%dt%dt%dt%dt%dt%dtn,sp-chinese,sp-math,sp-english,sp-huping,sp-pingde,sp-jiaoping);printf(平均分t綜合分n);printf(%.2ft%.2fn,sp-ave,sp-zhongping);if(PM=1)printf(平均分排名t綜合測(cè)評(píng)分排名n);printf(%dtt%dn,sp-paiming1,sp-paiming2);void SaveStruct(st

溫馨提示

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

評(píng)論

0/150

提交評(píng)論