學(xué)生信息管理系統(tǒng)C語(yǔ)言版_第1頁(yè)
學(xué)生信息管理系統(tǒng)C語(yǔ)言版_第2頁(yè)
學(xué)生信息管理系統(tǒng)C語(yǔ)言版_第3頁(yè)
已閱讀5頁(yè),還剩10頁(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)介

1、/交流學(xué)習(xí)/QQ:1194758555#include#include#include#include#includeintk,n;structstudentdoubleyuwen;doubleshuxue;doubleyingyu;doublezong;doublepingjun;charname20;charnum20;stu1000;voidjiazai(structstudentstu,int*num1);voidbaocun(structstudentstu,intn);voidfind(structstudentstu,intn);intfindnum(structstudents

2、tu,intn,char*num);/voidshanchu(structstudentstu,int*num1);voidshanchuyi(structstudentstu,int*num1);/voidshanchuquanbu(structstudentstu,int*num1);voidtianjiayi(structstudentstu,inti);/voidtianjia(structstudentstu,int*num1);/voidxiugai(structstudentstu,intn);/voidoutput(structstudentstu,intn,intx);/vo

3、idpaixu(structstudentstu,intn);/查找學(xué)號(hào);刪除一條記錄;添加一記錄;添加記錄;修改一條記錄;打印信息;排序;intjianchaxuehao(structstudentstu,char*num);/檢查學(xué)號(hào)的合法性;intjianchachengji(doublenum);/檢查成績(jī)的合法性;voidoutputone(structstudent*stu,inti,intx);/輸出一條信息voidcaidan();intmain()intq;jiazai(stu,&n);caidan();scanf(%d,&q);while(q6)(printf(-輸入錯(cuò)誤請(qǐng)

4、重新輸入n請(qǐng)輸入0-6的數(shù)字n);scanf(d”,&q);Sleep(300);system(cls);switch(q)(case1:tianjia(stu,&n);break;case2:xiugai(stu,n);break;case3:paixu(stu,n);break;case4:find(stu,n);break;case5:shanchu(stu,&n);break;case6:output(stu,n,0);break;case0:exit(0);return0;voidcaidan()(printf(i1n);printf(|歡迎進(jìn)入學(xué)生信息管理系統(tǒng)1n);printf(

5、|1n);printf(I1添加學(xué)生成績(jī)n);printf(|1n);printf(I2修改學(xué)生成績(jī)n);printf(|1n);printf(-I3排序n);printf(printf(n);printf(printf(n);printf(printf(n);printf(printf(n);printf(printf(printf(1n);查找1n);刪除11n);6輸出1I1n);1110退出1I1n);111n);請(qǐng)輸入選擇:n);voidjiazai(structstudentstu,int*num1)(FILE*fp;inti;if(fp=fopen(d:student.dat,r

6、)=NULL)(*num1=0;return;for(i=0;fread(&stui,sizeof(structstudent),1,fp)!=0;i+)*num1=i;fclose(fp);voidpaixu(structstudentstu,intn)(intxuehao(constvoid*a,constvoid*b);intyuwen(constvoid*a,constvoid*b);intshuxue(constvoid*a,constvoid*b);intyingyu(constvoid*a,constvoid*b);intzongchengji(constvoid*a,const

7、void*b);int(*cmp)(constvoid*a,constvoid*b)=xuehao,yuwen,shuxue,yingyu,zongchengji;inta;printf(printf(printf(1n);歡迎進(jìn)入學(xué)生信息排序頁(yè)面In);1n);printf(printf(printf(printf(printf(printf(printf(printf(printf(printf(printf(printf(110:1按學(xué)號(hào)降序排序1111:11按語(yǔ)文成績(jī)降序排序1112:11按數(shù)學(xué)成績(jī)降序排序113:1按英語(yǔ)成績(jī)降序排序1114:i1安總成績(jī)降序排序請(qǐng)輸入選擇:n);n)

8、;In);n);In);n);In);n);In);n);In);n);scanf(%d,&a);Sleep(300);system(cls);qsort(stu,n,sizeof(stu0),cmpa);output(stu,n,0);intxuehao(constvoid*a,constvoid*b)if(strcmp(structreturn-1;elsereturn1;intyuwen(constvoid*a,constvoid*b)return(structstudent*)a)-yuwen1:-1;intshuxue(constvoid*a,constvoid*b)return(s

9、tructstudent*)a)-shuxue1:-1;intyingyu(constvoid*a,constvoid*b)return(structstudent*)a)-yingyu1:-1;intzongchengji(constvoid*a,constvoid*b)return(structstudent*)a)-zongzong?1:-1;student*)a)-num,(struct(struct(structnum)0)*)b)-yuwen?*)b)-shuxue?*)b)-yingyu?voidshanchuyi(structstudentstu,int*num1)(inti,

10、in,c;chary20;FILE*fp;charstr20;printf(i1n);printf(I歡迎進(jìn)入學(xué)生信息刪除頁(yè)面In);printf(11n);printf(請(qǐng)輸入需要?jiǎng)h除的學(xué)號(hào)n);scanf(%s”,str);c=jianchaxuehao(stu,str);while(c=0)(printf(輸入的學(xué)號(hào)不合法請(qǐng)重新輸入n);scanf(%s”,str);c=jianchaxuehao(stu,str);Sleep(300);system(cls);printf(i1n);printf(I歡迎進(jìn)入學(xué)生信息刪除頁(yè)面In);printf(11n);in=findnum(stu,*

11、num1,str);while(in0)(printf(該學(xué)生的信息不存在n);printf(重新輸入(yes-y)返回主菜單(no-n)n);scanf(%s,y);while(strcmp(y,y)&strcmp(y,n)(printf(請(qǐng)輸入y或nn);scanf(%s,y);if(!strcmp(y,n)(Sleep(300);system(cls);main();Sleep(300);system(cls);printf(i1n);printf(I歡迎進(jìn)入學(xué)生信息刪除頁(yè)面n);printf(11n);printf(請(qǐng)輸入需要?jiǎng)h除的學(xué)號(hào)n);scanf(%s,str);in=findn

12、um(stu,*num1,str);for(i=in;i*num1-1;i+)stui=stui+1;(*num1)-;if(fp=fopen(d:student.dat,w)=NULL)printf(-打開(kāi)失敗n);exit(0);Sleep(300);system(cls);printf(i1n);printf(I歡迎進(jìn)入學(xué)生信息刪除頁(yè)面In);printf(11n);printf(刪除成功n);baocun(stu,*num1);printf(-繼續(xù)刪除(yes-y)返回上主菜單(no-n)n);getchar();scanf(%s,y);while(strcmp(y,y)&strcmp

13、(y,n)printf(請(qǐng)輸入y或nn);getchar();scanf(%s,y);Sleep(300);system(cls);if(!strcmp(y,n)main();if(!strcmp(y,y)shanchuyi(stu,num1);voidshanchuquanbu(structstudentstu,int*num1)chary20,a20;FILE*fp;printf(i1n);printf(I歡迎進(jìn)入學(xué)生信息刪除頁(yè)面In);printf(11n);printf(-是否全部刪除?(yes-y)返回主菜單(no-n)n);scanf(%s,y);while(strcmp(y,y)

14、&strcmp(y,n)printf(請(qǐng)輸入y或nn);scanf(%s,y);Sleep(300);system(cls);printf(i1n);printf(I歡迎進(jìn)入學(xué)生信息刪除頁(yè)面In);printf(11n);if(!strcmp(y,y)fp=fopen(d:student.dat,w);*num1=0;printf(-刪除完成n);fclose(fp);printf(返回主菜單(yes-y)結(jié)束(no-n)n);scanf(%s,a);while(strcmp(a,y)&strcmp(a,n)printf(請(qǐng)輸入y或nn);scanf(%s,a);Sleep(300);syst

15、em(cls);if(!strcmp(a,y)main();elseSleep(300);system(cls);return;elseSleep(300);system(cls);main();voidshanchu(structstudentstu,int*num1)(intq;printf(i1n);printf(-|刪除1n);printf(|1n);printf(-|1:刪除指定信息1n);printf(|1n);printf(-|2:刪除全部信息1n);printf(|1n);printf(11n);printf(請(qǐng)輸入選擇:n);getchar();scanf(%d,&q);sy

16、stem(cls);switch(q)(case1:shanchuyi(stu,num1);break;case2:shanchuquanbu(stu,num1);break;intfindnum(structstudentstu,intn,char*num)(inti;for(i=0;i0)(printf(i11111n1n);printf(|%-10s|%-6s|%-6s|%-6s|%-6s|%-6s|%-6s,學(xué)號(hào)姓名,語(yǔ)文,數(shù)學(xué),英語(yǔ),平均,總成績(jī)n);/printf(11n);for(i=0;inum,stu-name,stu-yuwen,stu-shuxue,stu-yingyu,

17、stu-pingjun,stu-zong);elseprintf(i11111r1n);printf(|%-8s|%-6s|%-6s|%-6s|%-6s|%-6s|%-6s,學(xué)號(hào),姓名,語(yǔ)文,數(shù)學(xué),英語(yǔ),平均,總成績(jī)n);printf(-I11111P1n);printf(|%-8s|%-6s|%-6.1lf|%-6.1lf|%-6.1lf|%-6.1lfI%-6.1lf|n,stu-num,stu-name,stu-yuwen,stu-shuxue,stu-yingyu,stu-pingjun,stu-zong);printf(111111n);voidtianjiayi(structstu

18、dentstu,inti)(inta,b;printf(-請(qǐng)輸入學(xué)生學(xué)號(hào)n);getchar();scanf(%s,stui.num);a=jianchaxuehao(stu,stui.num);while(a=0|a=2)(if(a=0)printf(輸入的學(xué)號(hào)不合法請(qǐng)重新輸入n);if(a=2)printf(輸入的學(xué)號(hào)與已有的重復(fù)請(qǐng)重新輸入n);scanf(%s,stui.num);a=jianchaxuehao(stu,stui.num);Sleep(300);system(cls);printf(in);printf(I歡迎進(jìn)入學(xué)生信息添加頁(yè)面n);printf(1n);printf(

19、-請(qǐng)輸入該學(xué)生姓名n);scanf(%s,);printf(請(qǐng)輸入語(yǔ)文成績(jī)n);scanf(%lf,&stui.yuwen);b=jianchachengji(stui.yuwen);while(b=0)(printf(輸入錯(cuò)誤請(qǐng)重新輸入n);scanf(%lf,&stui.yuwen);b=jianchachengji(stui.yuwen);printf(請(qǐng)輸入數(shù)學(xué)成績(jī)n);scanf(%lf,&stui.shuxue);b=jianchachengji(stui.shuxue);while(b=0)(printf(輸入錯(cuò)誤請(qǐng)重新輸入n);scanf(%lf,&stui.

20、shuxue);b=jianchachengji(stui.shuxue);printf(請(qǐng)輸入英語(yǔ)成績(jī)n);scanf(%lf,&stui.yingyu);b=jianchachengji(stui.yingyu);while(b=0)printf(輸入錯(cuò)誤請(qǐng)重新輸入n);scanf(%lf,&stui.yingyu);b=jianchachengji(stui.yingyu);stui.pingjun=(stui.yuwen+stui.shuxue+stui.yingyu)/3;stui.zong=stui.yuwen+stui.shuxue+stui.yingyu;voidtianjia

21、(structstudentstu,int*num1)charp10=y,y10;printf(i1n);printf(I歡迎進(jìn)入學(xué)生信息添加頁(yè)面In);printf(11n);while(!strcmp(p,y)tianjiayi(stu,*num1);(*num1)+=1;printf(是否繼續(xù)添加(yes-y,no-n)n);getchar();scanf(%s,p);while(strcmp(p,n)&strcmp(p,y)printf(請(qǐng)輸入y或nn);getchar();scanf(%s,p);Sleep(300);system(cls);baocun(stu,*num1);pri

22、ntf(返回主菜單(yes-y)結(jié)束(no-n)n);getchar();scanf(%s,y);while(strcmp(y,n)&strcmp(y,y)printf(請(qǐng)輸入y或nn);getchar();scanf(%s,y);if(!strcmp(y,y)(Sleep(300);system(cls);main();elsereturn;voidxiugai(structstudentstu,intn)(intin,b,c;chara10,q10;charstr20,y10;printf(i1n);printf(I歡迎進(jìn)入學(xué)生信息修改頁(yè)面In);printf(11n);printf(請(qǐng)輸

23、入要修改學(xué)生的學(xué)號(hào)n);getchar();scanf(%s,str);c=jianchaxuehao(stu,str);in=findnum(stu,n,str);while(c=0|in0)(if(in0|(in0&c=1)printf(-此條信息不存在n);if(c=0)printf(輸入不合法請(qǐng)重新輸入n);printf(重新輸入(yes-y)返回主菜單(no-n)n);scanf(%s,a);while(strcmp(a,y)&strcmp(a,n)(printf(請(qǐng)輸入y或nn);getchar();scanf(%s,a);Sleep(300);system(cls);printf

24、(-i1n);printf(I歡迎進(jìn)入學(xué)生信息修改頁(yè)面In);printf(11n);if(!strcmp(a,n)(Sleep(300);system(cls);main();printf(請(qǐng)輸入要修改學(xué)生的學(xué)號(hào)n);scanf(%s,str);c=jianchaxuehao(stu,str);in=findnum(stu,n,str);printf(修改前的信息如下:n);outputone(&stuin,n,1);printf(是否修改姓?(yes-y,no-n)n);getchar();scanf(%s,y);while(strcmp(y,y)&strcmp(y,n)(printf(請(qǐng)

25、輸入y或nn);getchar();scanf(%s,y);Sleep(300);system(cls);printf(i1n);printf(I歡迎進(jìn)入學(xué)生信息修改頁(yè)面In);printf(11n);if(!strcmp(y,y)(printf(請(qǐng)輸入姓名n);scanf(%s,);printf(是否修改%s的成績(jī)?(yes-y)返回主菜單(no-n)n,stuin.num);/getchar();scanf(%s,q);while(strcmp(q,y)&strcmp(q,n)(printf(請(qǐng)輸入y或nn);getchar();scanf(%s,q);if(!strc

26、mp(q,y)(printf(請(qǐng)輸入、的語(yǔ)文成績(jī)n,stuin.num);scanf(%lf,&stuin.yuwen);b=jianchachengji(stuin.yuwen);while(b=0)(printf(輸入錯(cuò)誤請(qǐng)重新輸入n);scanf(%lf,&stuin.yuwen);b=jianchachengji(stuin.yuwen);printf(請(qǐng)輸入、的數(shù)學(xué)成績(jī)n,stuin.num);scanf(%lf,&stuin.shuxue);b=jianchachengji(stuin.shuxue);while(b=0)(printf(輸入錯(cuò)誤請(qǐng)重新輸入n);scanf(%lf,

27、&stuin.shuxue);b=jianchachengji(stuin.shuxue);printf(請(qǐng)輸入、的英語(yǔ)成績(jī)n,stuin.num);scanf(%lf,&stuin.yingyu);b=jianchachengji(stuin.yingyu);while(b=0)(printf(輸入錯(cuò)誤請(qǐng)重新輸入n);scanf(%lf,&stuin.yingyu);b=jianchachengji(stuin.yingyu);if(!strcmp(q,n)(Sleep(300);system(cls);main();baocun(stu,n);printf(添加成功n返回主菜單(yes-y)結(jié)束(no-n)n);getchar();scanf(%s,y);while(strcmp(y,y)&strcmp(y,n)(printf(請(qǐng)輸入y或nn);getchar();scanf(%s,y);if(!strcmp(y,y)(Sleep(300);system(cls);main();elsereturn

溫馨提示

  • 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)論