學(xué)生成績(jī)管理系統(tǒng)-數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)說(shuō)明書(shū)_第1頁(yè)
學(xué)生成績(jī)管理系統(tǒng)-數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)說(shuō)明書(shū)_第2頁(yè)
學(xué)生成績(jī)管理系統(tǒng)-數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)說(shuō)明書(shū)_第3頁(yè)
學(xué)生成績(jī)管理系統(tǒng)-數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)說(shuō)明書(shū)_第4頁(yè)
學(xué)生成績(jī)管理系統(tǒng)-數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)說(shuō)明書(shū)_第5頁(yè)
已閱讀5頁(yè),還剩5頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

中北大學(xué)數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)說(shuō)明書(shū)學(xué)生姓名:學(xué)號(hào):

學(xué)院:軟件學(xué)院專業(yè):

軟件工程題目:學(xué)生成績(jī)管理系統(tǒng)指導(dǎo)教師薛海麗2011年12月20日設(shè)計(jì)任務(wù)概述〔包括系統(tǒng)總體框圖及功能描述〕設(shè)計(jì)內(nèi)容:〔1〕;〔2〕;〔3〕對(duì)合并后的文件3.txt中的數(shù)據(jù)按總分降序排序(至少采用兩種排序方法實(shí)現(xiàn));〔4〕輸入一個(gè)學(xué)生姓名后,能查找到此學(xué)生的信息并輸出結(jié)果(至少采用兩種查找方法實(shí)現(xiàn));〔5〕要求使用結(jié)構(gòu)體,鏈或數(shù)組等實(shí)現(xiàn)上述要求。設(shè)計(jì)要求:(1)符合課題要求,實(shí)現(xiàn)相應(yīng)功能;(2)要求界面友好美觀,操作方便易行;(3)注意程序的實(shí)用性、平安性;本設(shè)計(jì)所采用的數(shù)據(jù)結(jié)構(gòu)〔如:鏈表、棧、樹(shù)、圖等〕使用結(jié)構(gòu)體實(shí)現(xiàn)對(duì)學(xué)生信息的存儲(chǔ),包括姓名,三門(mén)成績(jī)?nèi)缦拢簊tructstudent_type{ charname[20]; floatscore1; floatscore2; floatscore3; doubleall;}選擇數(shù)組即結(jié)構(gòu)體數(shù)組實(shí)現(xiàn)對(duì)多個(gè)學(xué)生的信息存儲(chǔ);使用對(duì)文件的操作實(shí)現(xiàn)對(duì)學(xué)生信息的讀入,輸出和修改等操作;功能模塊詳細(xì)設(shè)計(jì)我的程序中有main()主函數(shù)和一個(gè)子函數(shù)voidsaveinfor();子函數(shù)用于〔模塊一〕;模塊二〕;模塊三〕(至少采用兩種排序方法實(shí)現(xiàn));輸入一個(gè)學(xué)生姓名后,能查找到此學(xué)生的信息并輸出結(jié)果(至少采用兩種查找方法實(shí)現(xiàn))〔模塊四〕;3.1詳細(xì)設(shè)計(jì)思想使用結(jié)構(gòu)體實(shí)現(xiàn)學(xué)生信息的存儲(chǔ),使用結(jié)構(gòu)體數(shù)組組成一個(gè)班的學(xué)生信息,利用對(duì)文件的操作滿足需求;voidsaveinfor()函數(shù)是實(shí)現(xiàn)該要求的主要函數(shù);利用for循環(huán)和標(biāo)準(zhǔn)輸入輸出函數(shù)的實(shí)現(xiàn)排序;程序中有用到文件的相關(guān)操作,比方文件的翻開(kāi),關(guān)閉,讀取文件,寫(xiě)入文件等,具體用到的函數(shù)有fopen(),fclose(),fwrite(),fread()等,在翻開(kāi)關(guān)閉的時(shí)候要判斷是否成功,依靠不成功返回空指針可以判斷出來(lái)。3.2核心代碼#include"string.h"#include"stdio.h"#defineSIZE10#include<conio.h>structstudent_type{ charname[20]; floatscore1; floatscore2; floatscore3; doubleall;}stud[SIZE];voidsaveinfor(){ FILE*filep1,*filep2,*filep3,*filep4; inti,j,max; doubleall;charname[20]; structstudent_typecount; if((filep1=fopen("d:\\file1.txt","wb"))==NULL)/*模塊一的起始*/ { printf("cannotopenfile\n"); return; } if((filep2=fopen("d:\\file2.txt","wb"))==NULL) { printf("cannotopenfile\n"); return; } for(j=0;j<2;j++) { if(j==0) for(i=0;i<5;i++)/*將學(xué)生信息寫(xiě)入文件*/ { if(fwrite(&stud[i],sizeof(structstudent_type),1,filep1)!=1) { printf("filewriteerror\n"); getch(); return; } } else for(i=5;i<SIZE;i++) { if(fwrite(&stud[i],sizeof(structstudent_type),1,filep2)!=1) { printf("filewriteerror\n"); getch(); return; } } } fclose(filep1); fclose(filep2); for(j=0;j<2;j++) { if(j==0) { filep1=fopen("d:\\file1.txt","rb"); printf("將filep1的學(xué)生信息輸出到屏幕:\n"); for(i=0;i<5;i++)/*將學(xué)生信息輸出到屏幕*/ { fread(&stud[i],sizeof(structstudent_type),1,filep1); printf("%-20s%4f%4f%4f\n",stud[i].name,stud[i].score1,stud[i].score2,stud[i].score3); } fclose(filep1); } else { filep2=fopen("d:\\file2.txt","rb"); printf("將filep2的學(xué)生信息輸出到屏幕:\n"); for(i=5;i<SIZE;i++)/*將學(xué)生信息輸出到屏幕*/ { fread(&stud[i],sizeof(structstudent_type),1,filep2); printf("%-20s%4f%4f%4f\n",stud[i].name,stud[i].score1,stud[i].score2,stud[i].score3); } fclose(filep2); } } filep1=fopen("d:\\file1.txt","rb"); filep2=fopen("d:\\file2.txt","rb"); for(i=0;i<SIZE;i++)/*實(shí)現(xiàn)file1與file2的合并*/ { fread(&stud[i],sizeof(structstudent_type),1,filep1); fread(&stud[i+5],sizeof(structstudent_type),1,filep2); } if((filep3=fopen("d:\\file3.txt","wb"))==NULL) { printf("cannotopenfile\n"); return; } for(i=0;i<SIZE;i++)/*將file1與file2中的數(shù)據(jù)輸出到file3*/ { if(fwrite(&stud[i],sizeof(structstudent_type),1,filep3)!=1) { printf("filewriteerror\n"); getch(); return; } } fclose(filep3); filep3=fopen("d:\\file3.txt","rb"); printf("filep3里的內(nèi)容:\n"); for(i=0;i<SIZE;i++)/*輸出file3的內(nèi)容*/ {fread(&stud[i],sizeof(structstudent_type),1,filep3); printf("%-20s%4f%4f%4f\n",stud[i].name,stud[i].score1,stud[i].score2,stud[i].score3); } fclose(filep3); /*模塊一的終結(jié)*/ if((filep4=fopen("d:\\file4.txt","wb"))==NULL)/*模塊二的開(kāi)始*/ { printf("cannotopenfile\n"); return; } filep3=fopen("d:\\file3.txt","rb"); printf("輸出filep3中不及格的人:\n"); for(i=0;i<SIZE;i++)/*輸出不及格的人*/ { if((stud[i].score1>=60&&stud[i].score2>=60&&stud[i].score3>=60)!=1) { printf("%-20s是不及格",stud[i].name); if(fwrite(&stud[i],sizeof(structstudent_type),1,filep4)!=1) { printf("filewriteerror\n"); getch(); return; } } } fclose(filep3); fclose(filep4); filep4=fopen("d:\\file4.txt","rb"); printf("輸出filep4中的內(nèi)容:\n"); for(i=0;i<SIZE;i++) {fread(&stud[i],sizeof(structstudent_type),1,filep4); printf("%-20s%4f%4f%4f\n",stud[i].name,stud[i].score1,stud[i].score2,stud[i].score3); } fclose(filep4); /*模塊二的終結(jié)*/ filep3=fopen("d:\\file3.txt","rb");/*模塊三的開(kāi)始*/ for(i=0;i<SIZE;i++) { if(fread(&stud[i],sizeof(structstudent_type),1,filep3)!=1){ printf("filewriteerror!\n"); getch(); return; } stud[i].all=stud[i].score1+stud[i].score2+stud[i].score3; } for(i=0;i<SIZE;i++)/*第一種實(shí)現(xiàn)降序的方法*/ { max=i; for(j=i+1;j<SIZE;j++) if(stud[max].all<stud[j].all) max=j; count=stud[i]; stud[i]=stud[max]; stud[max]=count; } for(i=0;i<SIZE;i++)/*第二種實(shí)現(xiàn)降序排列的方法*/ for(j=0;j<SIZE-i;j++) { if(stud[j].all<stud[j+1].all) { count=stud[j]; stud[i]=stud[i+1]; stud[i+1]=count; } } printf("輸出filep3中按降序排列的學(xué)生信息:\n"); for(i=0;i<SIZE;i++) { printf("%-20s%4f%4f%4f\n",stud[i].name,stud[i].score1,stud[i].score2,stud[i].score3); } fclose(filep3);/*模塊三的結(jié)束*/filep3=fopen("d:\\file3.txt","rb");/*模塊四的開(kāi)始*/ for(i=0;i<SIZE;i++) { if(fread(&stud[i],sizeof(structstudent_type),1,filep3)!=1) { printf("filewriteerror!\n"); getch(); return; } } printf("輸入一個(gè)學(xué)生姓名查找信息:\n");/*查找學(xué)生*/ scanf("%s",name); for(i=0;i<SIZE;i++) { if(!(strcmp(name,stud[i].name))) printf("%-20s%4f%4f%4f",stud[i].name,stud[i].score1,stud[i].score2,stud[i].score3); } fclose(filep3);/*模塊四的結(jié)束*/}voidmain(){ inti; printf("pleaseinputstudents'information\n"); printf("鍵入十個(gè)學(xué)生信息:\n"); printf("name\tscore1\tscore2\tscore3\n"); for(i=0;i<SIZE;i++) scanf("%s%f%f%f",stud[i].name,&stud[i].score1,&stud[i].score2,&stud[i].score3); saveinfor(); getch();}3.3程序運(yùn)行結(jié)果〔拷屏〕(見(jiàn)下頁(yè))課程設(shè)計(jì)心得、存

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(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)論