(精品論文)c語言課程設(shè)計_學生成績管理系統(tǒng)_第1頁
(精品論文)c語言課程設(shè)計_學生成績管理系統(tǒng)_第2頁
(精品論文)c語言課程設(shè)計_學生成績管理系統(tǒng)_第3頁
(精品論文)c語言課程設(shè)計_學生成績管理系統(tǒng)_第4頁
(精品論文)c語言課程設(shè)計_學生成績管理系統(tǒng)_第5頁
已閱讀5頁,還剩8頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

C語言課程設(shè)計報告:學生成績管理系統(tǒng)系統(tǒng)需求一、 當前學生信息:通過結(jié)構(gòu)體struct student 來保存學生的姓名,學號,性別,語文,數(shù)學,英語和計算機等等相關(guān)信息,并且通過cin函數(shù)來進行給當前學生輸入初始信息. 二、學生成績查詢: 輸入一個學號, 在文件中查找此學生, 若找到則輸出此學生的全部信息和成績; 若找不到則輸出查找失敗的信息. 同時也可以全部把各科的平均成績,最高和最低分輸出。三、新生插入 :通過給該生的學號來和原班上的學生的學號比較大小,若大就在后,若小則靠前排,將此生的信息保存下來。 四、輸出全部學生信息和全部學生成績。五、退出系統(tǒng).六、附加說明:系統(tǒng)將來完善的功能有:可以通過性別來模糊查詢,也可以通過姓名的姓來先進行模糊查詢,以便后面精確查找??傮w設(shè)計一、 仔細閱讀系統(tǒng)要求,首先將此系統(tǒng)化分為如下模塊(即如下函數(shù))1、輸入初始的學生信息:其中包括學生的姓名、學號和性別以及學生的語文、數(shù)學、英語和計算機等相關(guān)信息;可用函數(shù)cin(stu *p1)來實現(xiàn)此操作。 2、查詢模塊:可用stu *lookdata(stu *p1) 來實現(xiàn)。找到就輸出此學生全部信息包括學生的語文、數(shù)學、英語和計算機等的成績。 3、插入模塊:可用insert( )函數(shù)來實現(xiàn)。其中通過學號的大小來比較的,并且以此來排序。4、輸出學生的信息以及成績:通過學生的姓名來查看學生的語文、數(shù)學、英語和計算機等相關(guān)成績,同時也可以分別通過caverage() 、maverage() 、eaverage() 和comaverage() 來輸出語文、數(shù)學、英語和計算機等成績的平均分數(shù)、最高和最低分數(shù)。 5、退出系統(tǒng):可用一個函數(shù)exit()來實現(xiàn),首先將信息保存到文件中,釋放動態(tài)創(chuàng)建的內(nèi)存空間,再退出此程序。二、系統(tǒng)主模塊結(jié)構(gòu)圖: 詳細設(shè)計一、 界面設(shè)計此系統(tǒng)界面采用圖形和數(shù)字化菜單設(shè)計。主界面設(shè)計如下: 學生成績管理系統(tǒng) 請選擇相應(yīng)的數(shù)字執(zhí)行相應(yīng)的功能:1:是否輸入其他數(shù)據(jù)2:查看數(shù)據(jù)3:插入數(shù)據(jù)4:查找數(shù)據(jù)5:更新數(shù)據(jù)6:保留數(shù)據(jù)7:顯示或打印數(shù)據(jù)8:語文成績狀況9:數(shù)學成績狀況10:英語成績狀況11:計算機成績狀況12:?13:退出系統(tǒng)二、 數(shù)據(jù)結(jié)構(gòu)設(shè)計: 程序設(shè)計中用到的結(jié)構(gòu)體類型: 學生信息結(jié)構(gòu)體類型:typedef struct student char nameMAX; int numMAX; char sexMAX; int chinese; int mathematic; int english; int computer; struct student *next; 程序代碼:/原始密碼是123456#includestdio.h#includestddef.h#includestddef.h#includestring.h#define MAX 10typedef struct student /*定義結(jié)構(gòu)體*/ char nameMAX; /*姓名*/ int numMAX; /* 學號*/ char sexMAX; /*性別*/ int chinese; /*語文*/ int mathematic; /* 數(shù)學*/ int english; /*英語*/ int computer; /*計算機*/ struct student *next; /*結(jié)構(gòu)體指針*/ stu;stu *head; /*頭指針*/void print() /*顯示或打印函數(shù)*/ system(cls); printf(tttScore Manage Systemn); /*成績管理系統(tǒng)*/ printf(Enter Recordt); /*輸入數(shù)據(jù)*/ printf(Displayt); /*顯示*/ printf(Insertt); /*插入數(shù)據(jù)*/ printf(Questt); /*訪問數(shù)據(jù)*/ printf(Updatet); /*以前數(shù)據(jù)*/ printf(Savet); /*保留數(shù)據(jù)*/ printf(Fresht); /*更新數(shù)據(jù)*/ printf(Chinese Averaget); /*語文平均成績*/ printf(Math Averaget); /*數(shù)學平均成績*/ printf(English Averaget); /*英語平均成績*/ printf(Computer Averaget); /*計算機平均成績*/ printf(Quittn); /*退出*/ void cin(stu *p1) /*輸入相關(guān)數(shù)據(jù)的函數(shù)*/ printf(Enter name:n); scanf(%s,&p1-name); printf(Enter num:n); scanf(%d,&p1-num); printf(Enter sex:n); scanf(%s,&p1-sex); printf(Enter score:n); printf(Enter chinese:n); scanf(%d,&p1-chinese); printf(Enter math:n); scanf(%d,&p1-mathematic); printf(Enter English:n); scanf(%d,&p1-english); printf(Enter Computer:n); scanf(%d,&p1-computer); stu *cindata() /*其他數(shù)據(jù)是否繼續(xù)輸入的函數(shù)*/ stu *p1,*p2; int i=1; char ch; p1=(stu *)malloc(sizeof(stu); head=p1; while(i) cin(p1); printf(Do you Want to Continue?yes or no); /*是否繼續(xù)輸入數(shù)據(jù)*/ ch=getchar(); ch=getchar(); if(ch=n|ch=N) i=0; p1-next=NULL; else p2=p1; p1=(stu *)malloc(sizeof(stu); p2-next=p1; return(p1-next);stu *lookdata(stu *p1) /*查看數(shù)據(jù)的函數(shù)*/ while(p1!=NULL) printf(Num:%dt,p1-num); printf(Name:%st,p1-name); printf(Sex:%st,p1-sex); printf(n); printf(Chinese:%dt,p1-chinese); printf(Math:%dt,p1-mathematic); printf(English:%dt,p1-english); printf(Computer:%dt,p1-computer); printf(n); p1=p1-next; return p1; void insert() /*通過比較學號來插入數(shù)據(jù)的函數(shù)*/ stu *p1,*p3,*p2; char ch; p1=head; p3=(stu *)malloc(sizeof(stu); p3-next=NULL; if(head=NULL) head=p3; return; cin(p3); while(p1!=NULL&(p1-numnum) /*通過學號的比較來插入*/ p2=p1;p1=p1-next; if(p2=head) p3-next=head; head=p3; return; p3-next=p1; p2-next=p3; find(stu *p2) /*通過姓名查找查看數(shù)據(jù)的函數(shù)*/ char name20; int b=0; printf(Enter the name of the student you want to find:); /*通過姓名查看*/ scanf(%s,name); while(p2!=NULL) if(strcmp(name,p2-name)=0) printf(The data you want has be foundn); printf( Name:%st,p2-name); printf(Num:%dt,p2-num); printf(sex%st,p2-sex); printf(n); printf(Chinese:%dt,p2-chinese); printf(Math:%dt,p2-mathematic); printf(English:%dt,p2-english); printf(Computer:%dt,p2-computer); printf(n); b=1; else if(b=0) printf(sorry not find data!); p2=p2-next; if(b=1) print(); printf(Find onen); else print(); printf(Not findn); void caverage() /*求各學生語文平均分、最高和最低分成績的函數(shù)*/ stu *p1; int i; float max=0.0,min=200.0; float sum=0.0,aver=0; p1=head; if(p1=NULL) printf(not data!); else for(i=0;p1!=NULL;i+,p1=p1-next) sum+=p1-chinese; aver=sum/i; p1=head; for(i=0;p1!=NULL;i+,p1=p1-next) if(maxchinese) max=p1-chinese; p1=head; for(i=0;p1!=NULL;i+,p1=p1-next) if(minp1-chinese) min=p1-chinese; printf(Chinese Average:%f,aver); printf(Chinese Max:%f,max); printf(Chinese Min:%f,min); void maverage() /*求各學生數(shù)學平均分、最高和最低分成績的函數(shù)*/ stu *p1; int i; float max=0.0,min=200.0; float sum=0.0,aver=0; p1=head; if(p1=NULL) printf(not data!); else for(i=0;p1!=NULL;i+,p1=p1-next) sum+=p1-mathematic; aver=sum/i; p1=head; for(i=0;p1!=NULL;i+,p1=p1-next) if(maxmathematic) max=p1-mathematic; p1=head; for(i=0;p1!=NULL;i+,p1=p1-next) if(minp1-mathematic) min=p1-mathematic; printf(Mathe Average:%f,aver); printf(Mathe Max:%f,max); printf(Mathe Min:%f,min); void eaverage() /*求各學生英語平均分、最高和最低分成績的函數(shù)*/ stu *p1; int i; float max=0.0,min=200.0; float sum=0.0,aver=0; p1=head; if(p1=NULL) printf(not data!); else for(i=0;p1!=NULL;i+,p1=p1-next) sum+=p1-english; aver=sum/i; p1=head; for(i=0;p1!=NULL;i+,p1=p1-next) if(maxenglish) max=p1-english; p1=head; for(i=0;p1!=NULL;i+,p1=p1-next) if(minp1-english) min=p1-english; printf(English Average:%f,aver); printf(English Max:%f,max); printf(English Min:%f,min); void comaverage() /*求各學生計算機平均分、最高和最低分成績的函數(shù)*/ stu *p1; int i; float max=0.0,min=200.0; float sum=0.0,aver=0; p1=head; if(p1=NULL) printf(not data!); else for(i=0;p1!=NULL;i+,p1=p1-next) sum+=p1-computer; aver=sum/i; p1=head; for(i=0;p1!=NULL;i+,p1=p1-next) if(maxcomputer) max=p1-computer; p1=head; for(i=0;p1!=NULL;i+,p1=p1-next) if(minp1-computer) min=p1-computer; printf(Computer Average:%f,aver); printf(Computer Max:%f,max); printf(Computer Min:%f,min); update(stu *p2) /*通過姓名查找來更新數(shù)據(jù)*/ char name10; /*p2為指向結(jié)構(gòu)體struct student的指針*/ int b=0; printf(Enter The Name); /*輸入姓名*/ scanf(%s,name); while(p2!=NULL) if(strcmp(name,p2-name)=0) printf(Find you datan); scanf(Name:%s,p2-name); scanf(Num:%s,p2-num); scanf(Sex:%s,p2-sex); scanf(Chinese:%d,p2-chinese); scanf(Math:%d,p2-mathematic); scanf(english:%d,p2-english); scanf(Computer:%d,p2-computer); printf(Success!); b=1; else if(b=0) printf(Sorry not Find data!); p2=p2-next; if(b=0) print(); printf(Sorry not Find data!); else print(); printf(Finish!); save(stu *p2) /*保留數(shù)據(jù)函數(shù)*/ FILE *fp; char file10; printf(Enter file name); /*輸入文件名*/ scanf(%s,file); fp=fopen(file,w); while(p2!=NULL) fprintf(fp,%s,p2-name); fprintf(fp,%s,p2-num); fprintf(fp,%s,p2-sex); fprintf(fp,%d,p2-chinese); fprintf(fp,%d,p2-mathematic); fprintf(fp,%d,p2-english); fprintf(fp,%d,p2-computer); p2=p2-next; fclose(fp); char password7=123456; /*定義初始密碼*/void main() /*主函數(shù)*/ int choice; stu *p2; char s8; int flag=0,i; /*標志項*/ int n=3; do printf(Enter password:n); scanf(%s,s); if(!strcmp(s,password) /*進行密碼匹配驗證*/ printf(PASSnnn); flag=1; break; else printf(Error Enter again:n); n-; while(n0); if(!flag) printf(you have Enter 3 times!); /*輸入密碼超過了3次!*/ exit(0); /*自動退出*/ /*密碼驗證成功后進入的界面*/ printf(tttn); /*操作界面*/ printf(ttWelcom to the Misn); printf(Author:-tClass:-tNum:-n); /*作者,班級和號碼*/ printf(Adress:HGn); /*地址*/ printf(%n); printf(ttEnter OP:n); printf(nnnn); printf(=tt=n); printf(=tt=n); printf(ttEnter the MIS yes or non); /*問進入系統(tǒng)與否*/ scanf(%d,&choice); if(choice=n|choice=N) exit(1); print(); while(1) printf(Enter choice:); scanf(%d,&i); if(i13) printf(Enter num from 1 to 13:n); /*再從1-13中進行選擇*/ exit(1); switch(i) case 1: p2=cindata(); /*其他數(shù)據(jù)是否繼續(xù)輸入的函數(shù)*/ break; case 2: p2=lookdata(head); /*查看數(shù)據(jù)的函數(shù)*/ break; case 3: insert(); /*通過比較學號來插入數(shù)據(jù)的函數(shù)*/ break; case 4: find(head); /*通過姓名查找查看數(shù)據(jù)的函數(shù)*/ break; case 5: update(head); /*通過姓名查找來更新數(shù)據(jù)*/ break; case 6: save(head); /*保留數(shù)據(jù)函數(shù)*/ break; case 7: print(); /*顯示或打印函數(shù)*/ break; case 8: caverage(); /*求各學生語文平均分、最高和最低分成績的函數(shù)*/ break; case 9: maverage(); /*求各學生數(shù)學平均分、最高和最低分成績的函數(shù)*/ break; case 10: eaverage(); /*求各學生英語平均分、最高和最低分成

溫馨提示

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

評論

0/150

提交評論