學生成績管理系統(tǒng)_第1頁
學生成績管理系統(tǒng)_第2頁
學生成績管理系統(tǒng)_第3頁
學生成績管理系統(tǒng)_第4頁
學生成績管理系統(tǒng)_第5頁
已閱讀5頁,還剩28頁未讀, 繼續(xù)免費閱讀

付費下載

下載本文檔

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

文檔簡介

目錄1.需求分析 學生成績管理系統(tǒng)1.需求分析1.1問題描述學生信息鏈表實現(xiàn)需要完成創(chuàng)建學生信息鏈表、在文件讀寫信息、對學生信息鏈表的添加、刪除、修改、選擇出補考成績存入文件、按總績降序排序、按姓名學號查找、選擇出平均值、最大值、最小值、計算各科成績所占的比例。課題要求:現(xiàn)有學生成績信息文件1(1.txt),內(nèi)容如下:姓名

學號

語文

數(shù)學

英語

張明明

01

67

78

82李成友

02

78

91

88張輝燦

03

68

82

56王露

04

56

45

77陳東明

05

67

38

47…………學生成績信息文件2(2.txt),內(nèi)容如下:姓名

學號

語文

數(shù)學

英語

陳果

31

57

68

82李華明

32

88

90

68張明東

33

48

42

56李明國

34

50

45

87陳道亮

35

47

58

77…………1.2基本要求試編寫一個管理系統(tǒng),要求如下:1)要求使用鏈表或數(shù)組等實現(xiàn)上述要求2)實現(xiàn)對兩個文件數(shù)據(jù)進行合并,生成新文件3.txt3)可實現(xiàn)學生成績信息的輸入、修改、刪除功能4)抽取出三科成績中有補考的學生并保存在一個新文件4.txt5)對合并后的文件3.txt中的數(shù)據(jù)按總分降序排序(至少采用兩種排序方法實現(xiàn))6)輸入一個學生姓名后,能查找到此學生的信息并輸出結果(至少采用兩種查找方法實現(xiàn))7)統(tǒng)計輸出各門課程的平均分,最高分、最低分8)統(tǒng)計各門課程優(yōu)秀、良好、中等、及格、不及格的人數(shù)及百分比1.3成員分工小組成員:馬聰(組長)馬歡歡馬金瑩小組共同實現(xiàn)功能界面操作模塊。馬歡歡:實現(xiàn)的功能模塊1)創(chuàng)建寫入文件,讀取文件;2)創(chuàng)建學生信息鏈表并用文件保存;3)將兩文件中的信息合并,并放入第三個文件;4)鏈表的顯示函數(shù)。馬金瑩:實現(xiàn)的功能模塊1)實現(xiàn)學生成績信息的輸入、修改、刪除功能;2)抽取出三科成績中有補考的學生并保存在一個新文件;3)統(tǒng)計輸出各門課程的平均分,最高分、最低分。馬聰:實現(xiàn)的功能模塊1)對合并后的文件中的數(shù)據(jù)按總分降序排序(1冒泡排序法2選擇排序法);2)輸入一個學生姓名后,能查找到此學生的信息并輸出結果(1按姓名用順序查找法2按學號用折半查找法);3)統(tǒng)計各門課程優(yōu)秀、良好、中等、及格、不及格的人數(shù)及百分比。4)編寫驗證碼程序。2.概要設計2.1數(shù)據(jù)結構本程序使用單鏈表的結構來存儲各條學生信息。2.2程序模塊分析:系統(tǒng)要實現(xiàn)許多功能,因此遵循結構化程序設計思想來進行本系統(tǒng)的設計:自頂向下逐步細化,將系統(tǒng)設計任務分解出許多子功能模塊來設計;第一個模塊——主函數(shù)main()的功能是:調(diào)用各函數(shù)完成相應的功能。第二個模塊——Readfile()的功能是:文件的讀取。第三個模塊——Writefile()的功能是:文件的存儲。第四個模塊——Creatlist()的功能是:向文件中寫入信息。第五個模塊——Add()的功能是:添加學生信息。第六個模塊——Delete()的功能是:刪除學生信息。第七個模塊——Update()的功能是:清空所有文件。第八個模塊——Order()的功能是:排序。第九個模塊——Show()的功能是:結果的輸出。第十個模塊——Union()的功能是:文件的聯(lián)合。第十一個模塊——Makeupexam()的功能是:選擇出不考的學生信息放入文件中。第十二個模塊——AvgMaxMin()的功能是:顯示學生平均成績、最大成績、最小成績。第十三個模塊——Total()的功能是:成績的統(tǒng)計計算比例。第十四個模塊——PassWord()的功能是:進入成績輸入驗證碼。第十五個模塊——Function()的功能是:函數(shù)的鏈接調(diào)用。第十六個模塊——printf()的功能是:菜單的顯示。除主函數(shù)外,其他函數(shù)都通過一系列function函數(shù)連接。2.3各模塊之間的調(diào)用關系及算法設計2.3.1存儲結構typedefstruct{ charName[100]; charID[4]; intChinese; intMath; intEnglish;}Stu;typedefstructStud{ Stustudent; structStud*next;}Stud,*StudList;2.3.2程序流程圖由主函數(shù)進入程序由主函數(shù)進入程序密碼驗證通過后輸出主菜單學生信息管理系統(tǒng)1-創(chuàng)建文件2-合并文件3-信息變更4-補考信息5-成績排序6-查找信息7-成績均分8-成績等級比率0-返回未通過輸入對應編號0-退出系統(tǒng)1-創(chuàng)建文件1.txt2.txt2-合并文件為3.txt3-信息插入刪除修改1-冒泡排序2-選擇排序1-順序查找2-折半查找7.成績最高最低平均分8.成績優(yōu)秀良好及格比5-調(diào)用成績排序界面6-調(diào)用查找界面單4-補考學生信息4.txt退出系統(tǒng)3.詳細設計3.1主要函數(shù)的調(diào)用關系voidFunction(){ printf1(); intn; scanf("%d",&n); if(n<0||n>8) { printf("\t\t\t信息錯誤!請重新輸入:"); scanf("%d",&n); } system("cls"); switch(n) { case1: Creatlist(); Creatlist(); printf("\n\n\n\n\t\t\t\t文件創(chuàng)建成功?。?!"); printf("\n\n\t\t\t\t按任意鍵以繼續(xù)..."); getch(); system("cls"); Function(); break; case2: printf("1.txt與2.txt合并放入3.txt\n"); Union(); Function(); break; case3:function1();break; case4:Makeupexam();Function();break; case5:function2();break; case6:function3();break; case7:AvgMaxMin();system("cls");Function();break;case8:Total();Function();break;case0:PassWord();system("cls");Function();break; } }3.2各模塊的算法各模塊的功能實現(xiàn),主要代碼見源代碼。4.編碼調(diào)試4.1界面分析進入界面,請輸入密碼2012:驗證碼正確進入主界面:對學生信息進行修改界面:對學生信息進行排序界面:查找學生信息界面:4.2運行分析進行操作輸入相應的操作代碼,如果輸入操作代碼超出范圍就會顯示錯誤信息1、輸入密碼錯誤顯示:2、輸入超出邊界顯示3、顯示合并文件5.總結在持續(xù)兩周的實驗中,我們組三人一起共同努力,完成了學生成績管理系統(tǒng)的創(chuàng)建,在實驗中每個人有自己的工作,都積極參與到設計中。馬金瑩的總結:在本次實驗中,我的任務是實現(xiàn)學生成績信息的添加、刪除、修改功能;抽取出三科成績中有補考的學生并保存在一個新文件4.txt;統(tǒng)計輸出各門課程的平均分,最高分、最低分。在添加過程中,需要先讀取文件3.txt中的內(nèi)容,生成Studlist類型的指針p遍歷整個鏈表到末尾,用尾插法添加學生信息。修改模塊在遍歷鏈表的同時找出與需要修改學生姓名相同的結點,進行信息修改,若找不到則輸出該生不存在,指針繼續(xù)后移進行遍歷。在寫刪除模塊時,起初是用一個Studlist類型的指針P遍歷鏈表,在while循環(huán)中用p->next->name與要刪除的name比較,相等的話跳出循環(huán)(不等指針p后移),然后StudListq;q=p->next;p->next=q->next;free(q);這樣可以正確的刪除信息,但是當!P判斷學生不存在時,出現(xiàn)錯誤,p->next指向未知區(qū)域,總是出錯。所以改為兩個指針p指向l->next,q指向l,如果p->與要刪除的name相等,跳出循環(huán),不等p,q指針都后移。在求平均成績時,遍歷鏈表求出結點個數(shù)與各科總成績,相除得到平均成績。不足之處:各科都要單獨求出,程序重復累贅。寫程序需要縝密的思考以及細心,否則會帶來許多本可以避免的麻煩。而且通過這次實驗,還學到了一些系統(tǒng)函數(shù)以及控制程序執(zhí)行的小函數(shù)比如getch()等。馬歡歡的總結:這次課程設計使我對鏈表的創(chuàng)建更加深了印象,在此次試驗中我熟練掌握了Vc6.0編輯器的使用,對文件創(chuàng)建有了深刻的認識。我在實驗中的任務是實現(xiàn)創(chuàng)建鏈表并保存到指定的文件中,還可以實現(xiàn)合并兩個文件并保存到另外一個指定的文件中。比如:我用writefile()函數(shù)來寫文件,在該函數(shù)中用feopen以“寫”的方式來打開文件,具體的向文件寫數(shù)據(jù)則借助fscanf()函數(shù)來實現(xiàn);用Readfile()函數(shù)來讀文件,在該函數(shù)中用feopen以“讀”的方式打開文件,具體的讀文件則借助fprintf()函數(shù)來實現(xiàn);用Union()函數(shù),通過尾插法來實現(xiàn)文件的合并;用Show(n)含函數(shù)能把文件n中數(shù)據(jù)顯示到顯示屏上;通過上面幾個函數(shù)的應用使文件能夠自動生成和顯示,從而文件應用的時候更加完整。在創(chuàng)建鏈表時我用了Creatlist()函數(shù)來實現(xiàn),在該函數(shù)中通過輸入一個“姓名”于“*”不等來實現(xiàn)程序的自動化循環(huán)控制,通過*來結束程序的循環(huán)控制,然后通過調(diào)用writefile(L,n)函數(shù)來把創(chuàng)建好的鏈表保存到文件n中從而實現(xiàn)了創(chuàng)建鏈表并保存,以便下次操作時可以直接調(diào)用不用再新建鏈表。馬聰?shù)目偨Y:此次課程設計我在小組中擔當組長的重任需要很好的和小組成員之間進行交流、分配任務。我在實驗中所做的任務是編寫降序排序程序、查詢學生信息、統(tǒng)計學生信息各科成績等級比例。在實驗中我遇到了很多問題,在編寫排序程序時還是相當順利的,用了冒泡排序和選擇排序,在顯示的時候出現(xiàn)問題,直接調(diào)用Show()函數(shù)出現(xiàn)錯誤,顯示結果是文件3.txt中的內(nèi)容,并沒有進行排序,又重新編寫了輸出才顯現(xiàn)結果。在編寫查詢程序時,用了順序查找和折半查找,在折半查找中沒辦法用姓名查找所以改用學號查找,在查找時不知道怎么判斷查找不成功時的情況,最后改為if(low=high&&strcmp(q->student.ID,id)!=0)才編寫成功,雖然改變了題意但是完成了查找的任務也學會了使用折半查找。在total()函數(shù)中,本來想著用數(shù)組存儲課程信息,但是在調(diào)用不對,最后改為最簡單的編寫方式。在Fanction()函數(shù)時為了實現(xiàn)返回上一層的功能,進行了多次的重復調(diào)用,總是達不到預期的效果,就突然想起了用遞歸調(diào)用,達到了預期效果。在實驗中也許程序連接編譯沒錯,可能邏輯錯誤,所以調(diào)試很重要,這次課程設計給我的總體感覺是不僅在實驗中對鏈表的操作學習進行了更深刻的了解,而且更加加強了同學之間的相互交流合作能力。參考文獻[1]嚴蔚敏吳偉民.數(shù)據(jù)結構(C語言版).清華大學出版社,1997年4月,第一版,P18-27、P216-288。[2]譚浩強.C程序設計(第三版).清華大學出版社,2005年7月,第三版,P330-348。附錄:(源代碼)#include<stdio.h>#include<stdlib.h>#include<string.h>#include<conio.h>#include<windows.h>typedefstruct{ charName[100]; charID[4]; intChinese; intMath; intEnglish;}Stu;typedefstructStud{ Stustudent; structStud*next;}Stud,*StudList;//寫文件voidWritefile(StudListL,intn){ FILE*fp;switch(n) { case1: fp=fopen("1.txt","w");break; case2: fp=fopen("2.txt","w");break; case3: fp=fopen("3.txt","w");break; case4: fp=fopen("4.txt","w");break; } StudListp;p=L->next; while(p) { fprintf(fp,"%8s%4s%8d%8d%8d\n",p->student.Name,p->student.ID,p->student.Chinese,p->student.Math,p->student.English); p=p->next; } fclose(fp); }//讀文件voidReadfile(StudList&L,intn){FILE*fp;if(n==1) { if((fp=fopen("1.txt","r"))==NULL) { printf("打不開文件\n"); exit(0); } }if(n==2) { if((fp=fopen("2.txt","r"))==NULL) { printf("打不開文件\n"); exit(0); } }if(n==3) {if((fp=fopen("3.txt","r"))==NULL) { printf("打不開文件\n"); exit(0); } } if(n==4) { if((fp=fopen("4.txt","r"))==NULL) { printf("打不開文件\n"); exit(0); } } StudListq=L; while(!feof(fp)) { StudListp=(StudList)malloc(sizeof(Stud)); intn=fscanf(fp,"%8s%6s%8d%8d%8d",p->student.Name,p->student.ID,&p->student.Chinese,&p->student.Math,&p->student.English); if(n<0) break; p->next=NULL; q->next=p; q=p; } fclose(fp);}//創(chuàng)建學生信息鏈表voidCreatlist(){ charfilename[20]; printf("輸入文件名:\n"); scanf("%s",filename);StudListL=(StudList)malloc(sizeof(Stud));L->next=NULL; StudListp=(StudList)malloc(sizeof(Stud)); p->next=NULL; printf("\n"); printf("輸入以*結束:\n"); printf("\n"); printf("姓名學號語文數(shù)學英語\n"); StudListq=L; while(1) { StudLists=(StudList)malloc(sizeof(Stud)); scanf("%s",s->student.Name); if(strcmp(s->student.Name,"*")!=0) { scanf("%6s%4d%4d%4d",s->student.ID,&s->student.Chinese,&s->student.Math,&s->student.English);s->next=NULL; q->next=s; q=s; } else break; } if(strcmp("1.txt",filename)==0) Writefile(L,1); if(strcmp("2.txt",filename)==0) Writefile(L,2);}//顯示學生信息鏈表voidShow(intn){ StudListp,L=(StudList)malloc(sizeof(Stud)); L->next=NULL; Readfile(L,n); p=L->next; if(p==NULL) {printf("0>_<0~\n\n"); printf("不存在學生信息!\n\n");printf("請輸入任意鍵返回上一層:"); getch(); system("cls"); } else { printf("姓名\t學號\t語文\t數(shù)學\t英語\n"); while(p) { printf("%s\t%s\t%d\t%d\t%d\n",p->student.Name,p->student.ID,p->student.Chinese,p->student.Math,p->student.English); p=p->next; } printf("請輸入任意鍵返回上一層:"); getch(); system("cls"); }}//合并鏈表voidUnion(){ StudListL=(StudList)malloc(sizeof(Stud)); L->next=NULL;StudListS=(StudList)malloc(sizeof(Stud)); S->next=NULL; Readfile(L,1); Readfile(S,2); StudListp,q,r,w; p=L->next; while(p) { q=S->next; while(q) { r=S; if(strcmp(p->student.ID,q->student.ID)==0) { r->next=q->next; q=q->next; } else { q=q->next; r=r->next; } } p=p->next; } w=L->next; while(w->next) w=w->next; w->next=S->next; Writefile(L,3); Show(3);}//插入學生信息voidAdd(){ StudListL=(StudList)malloc(sizeof(Stud));L->next=NULL; Readfile(L,3); printf("\n\n\n添加學生信息\n\n"); printf("姓名學號語文數(shù)學英語:\n\n"); StudListn=(StudList)malloc(sizeof(Stud)); n->next=NULL; scanf("%s%s%d%d%d",n->student.Name,n->student.ID,&n->student.Chinese, &n->student.Math,&n->student.English); StudListp=L; while(p->next) { if(strcmp(p->student.ID,n->student.ID)==0) { printf("該學生已存在,請勿重復添加^^!\n"); printf("請輸入任意鍵返回上一層:"); getch(); system("cls"); return; } elseif(n->student.Chinese<0||n->student.English<0||n->student.Math<0|| n->student.Chinese>100||n->student.English>100||n->student.Math>100) {printf("輸入成績有誤^^!\n"); printf("請輸入任意鍵返回上一層:"); getch(); system("cls"); return; } p=p->next; } p->next=n; Writefile(L,3); Show(3); }//更新學生信息voidUpdate(){ StudListL=(StudList)malloc(sizeof(Stud)); L->next=NULL; Readfile(L,3); printf("\n\n\n修改學生信息\n\n"); printf("請輸入要修改學生的姓名:\n"); charname[10]; scanf("%s",name); StudListp=L->next; while(p) { if(strcmp(p->student.Name,name)==0) break; p=p->next; } if(p==NULL) { printf("\n\n不存在該生..#^_^\n"); printf("請輸入任意鍵返回上一層:"); getch(); system("cls"); return; } if(strcmp(p->student.Name,name)==0) { printf("\n\n該生原信息為:\n\n"); printf("姓名\t學號\t語文\t數(shù)學\t英語\n"); printf("%s\t%s\t%d\t%d\t%d\n\n\n",p->student.Name,p->student.ID, p->student.Chinese,p->student.Math,p->student.English); printf("請輸入修改后學生的信息:\n\n"); printf("姓名\t學號\t語文\t數(shù)學\t英語\n"); scanf("%s\t%s\t%d\t%d\t%d",p->student.Name,p->student.ID,&p->student.Chinese, &p->student.Math,&p->student.English); } Writefile(L,3); printf("修改成功,并寫入文件成功~~~~\n\n"); Show(3);}//刪除學生信息voidDelete(){ printf("請輸入要刪除學生的姓名:\n"); charname[10]; scanf("%s",name); StudListL=(StudList)malloc(sizeof(Stud)); L->next=NULL; Readfile(L,3); StudListp; p=L->next; StudListq; q=L; while(p) { if(strcmp(p->student.Name,name)==0) break; q=p; p=p->next; } if(!p) { printf("該生不存在!^^#\n"); printf("請輸入任意鍵返回上一層:"); getch(); system("cls"); return; } q->next=p->next; free(p); Writefile(L,3);printf("刪除成功~\n"); Show(3);}//求學生平均成績、最高成績、最低成績voidAvgMaxMin(){ StudListL=(StudList)malloc(sizeof(Stud)); L->next=NULL; Readfile(L,3); intn=0,max1,max2,max3,min1,min2,min3; floatsum=0,avg1,avg2,avg3; StudListp=L->next; while(p) { n++; p=p->next; } //語文 StudListq=L->next; while(q) { sum+=q->student.Chinese; q=q->next; } avg1=sum/n; max1=0; q=L->next; while(q) { if(q->student.Chinese>max1)max1=q->student.Chinese; q=q->next; } min1=101; q=L->next; while(q) { if(q->student.Chinese<min1)min1=q->student.Chinese; q=q->next; } //數(shù)學 q=L->next; while(q) { sum+=q->student.Math; q=q->next; } avg2=sum/n; max2=0; q=L->next; while(q) { if(q->student.Math>max2)max2=q->student.Math; q=q->next; } min2=101; q=L->next; while(q) { if(q->student.Math<min2)min2=q->student.Math; q=q->next; } //英語 q=L->next; while(q) { sum+=q->student.English; q=q->next; } avg3=sum/n; max3=0; q=L->next; while(q) { if(q->student.English>max3)max3=q->student.English; q=q->next; } min3=101; q=L->next; while(q) { if(q->student.English<min3)min3=q->student.English; q=q->next; } printf("\n\n各門功課的平均成績?yōu)椋篭n"); printf("\n"); printf("語文數(shù)學英語\n"); printf("%2.2f%2.2f%2.2f\n\n",avg1,avg2,avg3); printf("\n\n各門功課的最高成績?yōu)椋篭n"); printf("\n"); printf("語文數(shù)學英語\n"); printf("%2d%2d%2d\n\n",max1,max2,max3); printf("\n\n各門功課的最低成績?yōu)椋篭n"); printf("\n"); printf("語文數(shù)學英語\n"); printf("%2d%2d%2d\n\n",min1,min2,min3); printf("請輸入任意鍵返回"); getch();}//補考學生信息voidMakeupexam(){StudListL=(StudList)malloc(sizeof(Stud)); L->next=NULL; Readfile(L,3); StudListp=L->next,q=L; while(p) { if(p->student.Chinese>60&&p->student.English>60&&p->student.Math>60) { q->next=p->next; p=q->next; } else { p=p->next; q=q->next; } } Writefile(L,4); printf("\t補考學生信息\n"); Show(4);}//按總成績降序排序(冒泡法、選擇法)intsum(StudListp){ return(p->student.Chinese+p->student.English+p->student.Math);}voidOrder1()//冒泡排序{StudListL=(StudList)malloc(sizeof(Stud)); L->next=NULL; Readfile(L,3); StudListp1,p2; p1=L->next; intn=0; while(p1) { p1=p1->next; n++; } for(inti=0;i<n;i++) { StudListq=L->next; StudListp=L; StudListtemp=q->next; while(temp) { if(sum(q)>=sum(temp)) { temp=temp->next; q=q->next; p=p->next; } else { p->next=temp; q->next=temp->next; temp->next=q; temp=q->next; p=p->next; } } } p2=L->next; printf("按降序排序輸出:\n\n"); printf("姓名學號語文數(shù)學英語總成績\n\n"); while(p2) { printf("%-8s%4s%4d%4d%4d%5d\n",p2->student.Name,p2->student.ID,p2->student.Chinese,p2->student.Math,p2->student.English,sum(p2)); p2=p2->next; } printf("請輸入任意鍵返回上一層:"); getch(); system("cls");}voidOrder2()//選擇排序{ StudListL=(StudList)malloc(sizeof(Stud)); L->next=NULL; Readfile(L,3); StudListp,q,p1; p=L->next; Stust; intsum1=0,sum2=0; while(p) { sum1=p->student.Chinese+p->student.English+p->student.Math; q=p->next; while(q) { sum2=q->student.Chinese+q->student.English+q->student.Math; if(sum1<=sum2) { st=p->student; p->student=q->student; q->student=st; q=q->next; sum1=sum2; } else q=q->next; } p=p->next; if(!p) break; q=p->next; } p1=L->next; printf("按降序排序輸出:\n\n"); printf("姓名學號語文數(shù)學英語總成績\n\n"); while(p1) { printf("%-8s%4s%4d%4d%4d%5d\n",p1->student.Name,p1->student.ID,p1->student.Chinese,p1->student.Math,p1->student.English,sum(p1)); p1=p1->next; } printf("請輸入任意鍵返回上一層:"); getch(); system("cls"); }//按學生姓名、學號查找voidSearch1()//順序查找(學生姓名){ StudListL=(StudList)malloc(sizeof(Stud)); L->next=NULL; Readfile(L,3); printf("請輸入要查找的學生姓名:"); charname[16]; scanf("%s",name); StudListp; p=L->next; while(p) { if(strcmp(p->student.Name,name)!=0) p=p->next; else break; } if(p==NULL) { printf("此學生信息不存在!!!\n\n");printf("請輸入任意鍵返回上一層:"); getch(); system("cls"); return; } if(strcmp(p->student.Name,name)==0) { printf("輸出該學生信息為:\n"); printf("姓名學號語文數(shù)學英語\n\n"); printf("%-8s%4s%4d%4d%4d\n\n",p->student.Name,p->student.ID,p->student.Chinese,p->student.Math,p->student.English); } printf("請輸入任意鍵返回上一層:"); getch(); system("cls");}voidsearch2()//折半查找(學號){ StudListL=(StudList)malloc(sizeof(Stud)); L->next=NULL; Readfile(L,3); StudListp,q; p=q=L->next; printf("請輸入要查找的學生的學號:"); charid[16]; scanf("%s",id); intn=0; while(p) { p=p->next; n++; } intlow,high,mid; low=1;high=n; while(low<=high) { q=L->next; for(intj=1;j<low;j++) { q=q->next; } mid=(low+high)/2; for(inti=low;i<mid;i++) q=q->next; if(strcmp(q->student.ID,id)==0) break; elseif(strcmp(q->student.ID,id)>0) high=mid-1; else low=mid+1; } if(low=high&&strcmp(q->student.ID,id)!=0) printf("此學生信息不存在!\n\n"); else { printf("輸出該學生信息為:\n"); printf("姓名學號語文數(shù)學英語\n\n"); printf("%-8s%4s%4d%4d%4d\n\n",q->student.Name,q->student.ID,q->student.Chinese,q->student.Math,q->student.English); } printf("請輸入任意鍵返回上一層:"); getch(); system("cls");}//計算優(yōu)秀率,良好率,中等率,及格率,不及格率voidTotal(){ StudListL=(StudList)malloc(sizeof(Stud)); L->next=NULL; Readfile(L,3); StudLists=L->next; intn=0,n1=0,n2=0,n3=0,n4=0,n5=0; floatper1=0.0,per2=0.0,per3=0.0,per4=0.0,per5=0.0; StudListp=L->next; while(p) { if(p->student.Chinese>=90) n1++; elseif(p->student.Chinese<90&&p->student.Chinese>=80) n2++; elseif(p->student.Chinese<80&&p->student.Chinese>=70) n3++; elseif(p->student.Chinese<70&&p->student.Chinese>=60) n4++; elseif(p->student.Chinese<60) n5++; n++; p=p->next; } per1=(float)n1/n*100; per2=(float)n2/n*100; per3=(float)n3/n*100; per4=(float)n4/n*100; per5=(float)n5/n*100; printf("\n\n語文課程\n"); printf("\n"); printf("等級優(yōu)秀良好中等及格不及格\n"); printf("人數(shù)%2d%2d%2d%2d%2d\n",n1,n2,n3,n4,n5); printf("百分比(%)%2.2f%2.2f%2.2f%2.2f%2.2f\n",per1,per2,per3,per4,per5); printf("\n"); n1=0,n2=0,n3=0,n4=0,n5=0; per1=0.0,per2=0.0,per3=0.0,per4=0.0,per5=0.0; p=L->next; while(p) { if(p->student.Math>=90) n1++; elseif(p->student.Math<90&&p->student.Math>=80) n2++; elseif(p->student.Math<80&&p->student.Math>=70) n3++; elseif(p->student.Math<70&&p->student.Math>=60) n4++; elseif(p->student.Math<60) n5++; p=p->next; } per1=(float)n1/n*100; per2=(float)n2/n*100; per3=(float)n3/n*100; per4=(float)n4/n*100; per5=(float)n5/n*100; printf("\n\n數(shù)學課程\n"); printf("\n"); printf("等級優(yōu)秀良好中等及格不及格\n"); printf("人數(shù)%2d%2d%2d%2d%2d\n",n1,n2,n3,n4,n5); printf("百分比(%)%2.2f%2.2f%2.2f%2.2f%2.2f\n",per1,per2,per3,per4,per5); printf("\n"); n1=0,n2=0,n3=0,n4=0,n5=0; per1=0.0,per2=0.0,per3=0.0,per4=0.0,per5=0.0; p=L->next; while(p) { if(p->student.English>=90) n1++; elseif(p->student.English<90&&p->student.English>=80) n2++; elseif(p->student.English<80&&p->student.English>=70) n3++; elseif(p->student.English<70&&p->student.English>=60) n4++; elseif(p->student.English<60) n5++; p=p->next; } per1=(float)n1/n*100; per2=(float)n2/n*100; per3=(float)n3/n*100; per4=(float)n4/n*100; per5=(float)n5/n*100; printf("\n\n英語課程\n"); printf("\n"); printf("等級優(yōu)秀良好中等及格不及格\n"); printf("人數(shù)%2d%2d%2d%2d%2d\n",n1,n2,n3,n4,n5); printf("百分比(%)%2.2f%2.2f%2.2f%2.2f%2.2f\n",per1,per2,per3,per4,per5); printf("\n"); printf("請輸入任意鍵返回上一層:"); getch(); system("cls");}//顯示界面voidprintf(){ printf("\n\n\n\n\n\n"); printf("\t\t\t歡迎進入學生成績管理系統(tǒng)d(n_n)b\n\n\n"); printf("\t\t\t請輸入驗證碼進入:"); }voidprintf1(){ printf("\n\n\n\n"); printf("\t\t1.創(chuàng)建兩個鏈表保存在1.txt、2.txt文件中\(zhòng)n"); printf("\t\t2.合并兩個文件保存在3.txt文件中\(zhòng)n"); printf("\t\t3.對文件進行插入、刪除、修改\n"); printf("\t\t4.抽取補考學生信息保存在4.txt中\(zhòng)n"); printf("\t\t5.對3.txt中的數(shù)據(jù)按總分降序排序\n"); printf("\t\t6.查找學生信息\n"); printf("\t\t7.統(tǒng)計各門課程的平均分、最高分、最低分\n"); printf("\t\t8.統(tǒng)計各門課程優(yōu)秀、良好、中等、及格、不及格的人數(shù)及百分比\n"); printf("\t\t0.返回上一層\n");printf("\t\t請輸入操作編碼:");}voidprintf2(){ printf("\n\n\n\n"); printf("\t\t\t1.插入一個學生的信息!\n"); printf("\t\t\t2.刪除一個學生的信息!\n"); printf("\t\t\t3.修改一個學生的信息!\n"); printf("\t\t\t0.返回上一層!\n"); printf("\t\t\t請輸入操作編碼:");}voidprintf3(){printf("\n\n\n\n\n"); printf("成績按總分降序排序:\n\n\n"); printf("1.冒泡排序\n"); printf("2.選擇排序\n"); printf("

溫馨提示

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

評論

0/150

提交評論