2022年c語言程序設計學生成績管理系統(tǒng)_第1頁
2022年c語言程序設計學生成績管理系統(tǒng)_第2頁
2022年c語言程序設計學生成績管理系統(tǒng)_第3頁
2022年c語言程序設計學生成績管理系統(tǒng)_第4頁
2022年c語言程序設計學生成績管理系統(tǒng)_第5頁
已閱讀5頁,還剩34頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、學習 - 好資料 試驗題目 :同學成果治理系統(tǒng) 一, 試驗目的 1. 2. 熟識 c 語言的編譯連接和運行過程; 把握 c 語言的數據類型,熟識整型,實型,字符型變量的定義方式及如何給 它們賦值; 3. 4. 5. 6. 把握 if 語句及 switch 語句的運用方法及嵌套應用方法; 把握實現循環(huán)結構的三種語句 while, do-while., for 的使用; 把握函數的定義方法和調用方法; 能夠接受模塊化思想調試程序; 二試驗內容 1. 編寫程序并進行調試運行; 2. 輸入同學資料 ,并儲存于文件;每個同學包含信息如:姓名,學號,性別,物 理成果,數學成果,英語成果,運算機成果; 3.

2、對已存入的同學信息進行更新操作 息和修改同學信息; ,包括更新同學信息信息, 刪除某個同學信 4.通過按同學姓名的方式查詢同學信息; 5.輸入某同學各門成果進行統(tǒng)計; 6 對同學物理成果排序; 7.最終輸出同學信息,供需要時打?。?二, 需求分析 1. 該程序可用于對同學的基本信息的儲備,更新,查詢,輸出,統(tǒng)計,排序等 操作; 其中更新功能包括:添加信息,刪除信息,修改信息,可依據需要2. 添加一個 信息,也可對個別同學信息進行適當的刪除或修改;以便隨時更 或多個同學 新同學信息; 3.程序中設計的查詢功能可依據需要從如干數據中查詢某信息, 四,概要設計 1,方案設計 對系統(tǒng)進行分析,給出結構

3、圖 分析:系統(tǒng)要求實現許多的功能, 因此遵循結構化程序設計思想來進行本系統(tǒng) 的設計自頂向下, 逐步細化, 將系統(tǒng)設計任務分解出許多子功能模塊進行設計 結構圖如下: 更多精品文檔 第 1 頁,共 23 頁學習 - 好資料 同學成果管 顯 輸 插 查 更 統(tǒng) 成 物 數 英 計 保 輸 示 入 入 看 新 計 績 理 學 語 算 存 出 數 數 數 數 數 成 排 成 成 成 機 數 數 據 據 據 據 據 績 序 績 績 績 成 據 據 績 更 刪 修 物 數 英 計 物 新 除 改 理 學 語 算 理 數 數 數 總 總 總 機 成 據 據 據 分 分 分 平 績 和 和 和 均 排 平 平

4、平 分 序 更多精品文檔 第 2 頁,共 23 頁學習 - 好資料 五 功能模塊的說明 1 輸入初始同學信息:其中包括同學姓名,學號,性別,物理 機成果 等相關信息;可用函數 cinstu *p1 來實現此操作; 數學 英語 運算 2 查詢模塊:可用 stu *lookdatastu *p1 來實現;找到就輸出此同學全部信息包 括同學物理 數學 英語 運算機的成果 ; 3 插入模塊:可用 insert來實現;其中通過學號的大小比較的,并且以此來排 序; 4 輸出同學的信息及成果:通過同學的姓名來查看同學的語文 數學 英語 運算 機的有關成果,同時也可以分別通過 paverage maverag

5、e eaverage comaverage 來輸出物理 數學 英語 運算機等成果的平均分 最高分 最低分; 5 退出系統(tǒng): 可以用一個函數來實現, 第一將信息儲存在文件中, 釋放動態(tài)創(chuàng)建 的內存空間,再退出次程序; 流程圖如下 六 調試情形及運行結果 1,對自己設計進行評判,指出合理和不足之處,提出改進的方案; 此次實踐課編寫的是一個應用程序, 相對于以前我們見到的程序, 它 要大得多, 于是就按課本上的例子編了超市治理系統(tǒng), 先把界面弄好然后 再添加各模塊,而且各模塊也顯現了不少問題, 在同學們和老師的幫忙下, 我很有耐心的一次又一次的進行修改, 的目的;可結果仍不是太理想; 最終運行的結果

6、基本上達到了預期 由于時間很短, 在選題報告中設想到的好多功能都沒有實現; 已有的 那些功能雖已能基本上中意治理者和消費者的需要, 但假如仍有更多的功 能程序就會更加完善;如:進入系統(tǒng)時沒有設制密碼,愛惜性不夠強;在 輸入商品號時沒有出錯提示,假如商品號輸入負值 2,在設計過程中的感受; 本次 C 語言的實習課讓我對 C 語言的學習又有了更深化的明白, 也讓 我更深刻地領悟到了 “實踐出真理” 這個道理, 在上機實踐過程中學到的 學問遠遠超過了在課堂上十幾周學到的, 學校組織的這次實習讓我們這些 實踐學問匱乏的高校生增加了許多社會體會, 了不小的鋪墊作用; 本次實習中遇到了許多以前沒有遇到過的

7、問題, 為我們將來走上工作崗位其 也曾想過要舍棄, 但看到 那些同學都在那認真的寫程序, 給了我連續(xù)的信心; 在同學的幫忙下, 我 順當的終止了本次實習, 讓我知道原先憑借自己努力取得的成功會讓自己 這么欣慰,也讓我知道了友情和團結的重要性; 七參考文獻 C 語言程序設計 王曙燕 曹錳 科學出版社 八;附錄: #include 更多精品文檔 第 3 頁,共 23 頁學習 - 好資料 #include #include #include #include #include #define MAX 10 int sum=10; typedef struct student /* 定義結構體 */

8、char nameMAX; int num; char sexMAX; /* 姓名 */ /* 學號 */ /* 性別 */ /* 語文 */ /* 數學 */ /* 英語 */ /* 運算機 */ /* 結構體指針 */ float physic; float mathematic; float english;float computer; struct student *next; stu; stu *head; /* 讀取信息 */ int read_message FILE *fp; stu *p; int i=0; iffp=fopenstudent_manage.txt,rb=N

9、ULL printfnn* 暫時仍沒有任何信息,輸入密碼進入主菜單選擇基本信息錄入! *n; return 0; whilefeoffp.=1 freadhead,sizeofstu,1,fp; ifp-num=0 break; else i+; fclosefp; returni; 更多精品文檔 第 4 頁,共 23 頁學習 - 好資料 /* 顯示或打印函數 */ void print */ */ printfttt Score Manage Systemn; 輸入數據 n; n; /* 成果治理系統(tǒng) printfttt 成果治理系統(tǒng) n; /* 輸入數據 printf Enter Reco

10、rd : printf Display : 顯示或打印 /* 顯 示*/ printf find : 查找數據 n; /* 拜望數 據*/ printf Renew_message: 更新模塊 n; /* 更新 模塊 */ printf */ Save: 儲存數據 n; /* 物 printf sort_physic: 成果排名 n; 理成果排名 */ Count: 數據統(tǒng)計 n; /* printf 數據統(tǒng)計 */ Physic Average: 物理平均成果 n; /* 物 printf 理平均成果 */ printf Math Average: 數學平均成果 n; /* 數學平均成果 *

11、/ English Average: 英語平均成果 n; /* 英 printf 語平均成果 */ printf Computer Average:運算機平均成果 n; /* 運算機平均成果 Quit : 退出 tn; printf /* 退出 */ /* 輸入相關數據函數 */ void cinstu *p1 printfn Enter name:n; scanf%s,&p1-name; printfEnter num:n; 更多精品文檔 第 5 頁,共 23 頁學習 - 好資料 scanf%d,&p1-num; printfEnter sex:n; scanf%s,&p1-sex; pri

12、ntfEnter scoren; printfEnter physic:n; scanf%f,&p1-physic; printfEnter mathematic:n; scanf%f,&p1-mathematic; printfEnter english:n; scanf%f,&p1-english; printfEnter computer:n; scanf%f,&p1-computer; /* 其他數據是否輸入函數 */ stu *cindata stu *p1,*p2; int i=1; char ch; p1=stu*mallocsizeofstu; head=p1; whilei

13、cinp1; printfDo you want to continue.Yes or no:n; fflushstdin; ch=getchar; ifch=n|ch=N i=0; p1-next=NULL; else p2=p1; p1=stu*mallocsizeofstu; p2-next=p1; returnp1-next; 更多精品文檔 第 6 頁,共 23 頁學習 - 好資料 /* 查看數據函數 */ stu *lookdatastu *p1 whilep1.=NULL printfName:%st,p1-name; printfNum:%dt,p1-num; printfSex

14、:%st,p1-sex; printfn; printfPhysic:%ft,p1-physic; printfMath:%ft,p1-mathematic; printfEnglish:%ft,p1-english; printfComputer:%ft,p1-computer; printfn; p1=p1-next; return p1; /* 通過比較學號來插入數據的函數 */ void insert stu *p1,*p3,*p2; p1=head; p3=stu*mallocsizeofstu; p3-next=NULL; ifhead=NULL head=p3;return; c

15、inp3; whilep1.=NULL&p1-numnum p2=p1;p1=p1-next; ifp2=head p3-next=head; head=p3;return; p3-next=p1; p2-next=p3; 更多精品文檔 第 7 頁,共 23 頁學習 - 好資料 /* 通過姓名來查找的函數 */ void findstu *p2 char name20; int b=0; printfEnter the name of the sutdent you want to find:; scanf%s,name; whilep2.=NULL ifstrcmpname,p2-name=

16、0 printf The data you want has be find ; printfName:%st,p2-name; printfNum:%dt,p2-num; printfSex:%st,p2-sex; printfn; printfPhysic%ft,p2-physic; printfMath%ft,p2-mathematic; printfEnglish%ft,p2-english; printfComputer%ft,p2-computer; printfn; b=1; else ifb=0 printfsorry not find data.; p2=p2-next; i

17、fb=1 print; printfFind onen; else print; printfNot findn; 更多精品文檔 第 8 頁,共 23 頁學習 - 好資料 /* 求各同學物理平均成果 */ void paverage stu *p1; int i; float max=0.0,min=200.0; float sum=0.0,aver=0; p1=head; ifp1=NULL printfnot data.; else fori=0;p1.=NULL;p1=p1-next sum+=p1-physic; aver=sum/i; p1=head; fori=0;p1.=NULL

18、;i+,p1=p1-next ifmaxphysic max=p1-physic; p1=head; fori=0;p1.=NULL;i+,p1=p1-next ifminp1-physic min=p1-physic; printfPhysic Average:%f ,aver; printfPhysic Max:%f,max; printfPhysic Min:%f,max; /* 求各同學數學平均分 最高和最低分成果的函數 */ void maverage 更多精品文檔 第 9 頁,共 23 頁學習 - 好資料 stu *p1; int i; float max=0.0,min=200.

19、0; float sum=0.0,aver=0; p1=head; ifp1=NULL printfnot data.; else for i=0;p1.=NULL;i+,p1=p1-next sum+=p1-mathematic; aver=sum/i; p1=head; fori=0;p1.=NULL;i+,p1=p1-next ifmaxmathematic max=p1-mathematic; p1=head; fori=0;p1.=NULL;i+,p1=p1-next ifminp1-mathematic min=p1-mathematic; printfMath Average:%

20、f,aver; printfMath Max:%f,max; printfMath Min:%f,min; /* 求各同學英語平均分 最高和最低分成果的函數 */ void eaverage stu *p1; int i; float max=0.0,min=200.0; float sum=0.0,aver=0; p1=head; ifp1=NULL 更多精品文檔 第 10 頁,共 23 頁學習 - 好資料 printfnot data.; else fori=0;p1.=NULL;i+,p1=p1-next sum+=p1-english; aver=sum/i; p1=head; for

21、i=0;p1.=NULL;i+,p1=p1-next ifmaxenglish max=p1-english; p1=head; fori=0;p1.=NULL;i+,p1=p1-next ifminp1-english min=p1-english; printfEnglish Average:%f,aver; printfEnglish Max:%f,max; printfEnglish Min:%f,min; /* 求各同學運算機平均成果 最高和最低分 */ void comaverage stu *p1; int i; float max=0.0,min=200.0; float su

22、m=0.0,aver=0; p1=head; ifp1=NULL printfnot data.; else fori=0;p1.=NULL;i+,p1=p1-next sum+=p1-computer; aver=sum/i; p1=head; 更多精品文檔 第 11 頁,共 23 頁學習 - 好資料 fori=0;p1.=NULL;i+,p1=p1-next ifmaxcomputer max=p1-computer; p1=head; fori=0;p1.=NULL;i+,p1=p1-next ifminp1-computer min=p1-computer; printfCompute

23、r Average:%f,aver; printfComputer Max:%f,max; printfComputer Min:%f,min; /* 統(tǒng)計物理平均和總分 */ void aver_sum_physic stu *p1; int i; float sum=0,aver; p1=head; ifp1=NULL printfnot data.; else fori=0;p1.=NULL;i+,p1=p1-next sum+=p1-physic; aver=sum/i; printfPhysic Average:%f,aver; printfPhysic Sum:%f,sum; /*

24、 統(tǒng)計數學平均和總分 */ void aver_sum_mathematic stu *p1; int i; float sum=0,aver; 更多精品文檔 第 12 頁,共 23 頁學習 - 好資料 p1=head; ifp1=NULL printfnot data.; else fori=0;p1.=NULL;i+,p1=p1-next sum+=p1-mathematic; aver=sum/i; printfMathematic Average:%f,aver; printfMathematic Sum:%f,sum; /* 統(tǒng)計英語平均和總分 */ void aver_sum_en

25、glish stu *p1; int i; float sum=0,aver; p1=head; ifp1=NULL printfnot data.; else fori=0;p1.=NULL;i+,p1=p1-next sum+=p1-english; aver=sum/i; printfEnglish Average:%f,aver; printfEnglish Sum:%f,sum; /* 統(tǒng)計運算機平均和總分 */ void aver_sum_computer stu *p1; int i; float sum=0,aver; p1=head; ifp1=NULL printfnot

26、data.; else fori=0;p1.=NULL;i+,p1=p1-next 更多精品文檔 第 13 頁,共 23 頁學習 - 好資料 sum+=p1-computer; aver=sum/i; printfComputer Average:%f,aver; printfComputer Sum:%f,sum; /* 統(tǒng)計模塊 */ void count int choice; do printf * 統(tǒng)計同學平均分和總分 *n; printf : 物理平均和總分 n; printf : 數學平均和總分 n; printf : 英語平均和總分 n; printf : 運算機平均和總分 n

27、; printf 返回主菜單 :n; printf 請選擇 04:n; scanf%d,&choice; switchchoice case 1:aver_sum_physic;break; case 2:aver_sum_mathematic;break; case 3:aver_sum_english;break; case 4:aver_sum_computer;break; case 0:break; whilechoice.=0; /* 物理成果排序 */ /* 庫存排行 */ sort_physic int i=1,j=1; float min; 更多精品文檔 第 14 頁,共 2

28、3 頁學習 - 好資料 stu *newh,*newp,*tp1,*tp2,*p; newp=newh=NULL; tp1=tp2=NULL; p=head; do i+; p=p-next; whilep-next; whilehead.=NULL p=head; tp1=tp2=p; min=p-physic; whilep-next.=NULL ifp-next-physicnext-physic; tp1=p; tp2=p-next; p=p-next; ifnewh=NULL newp=newh=tp2; else newp-next=tp2; newp=tp2; iftp2=hea

29、d head=tp2-next; else tp1-next=tp2-next; tp2-next=NULL; head=newh; p=head; forj=1;jname,p-sex,p-num,p-physic; p=p-next; else break; printfn 按任意鍵返回 n; getch; /* 刪除相關數據 */ shanchu int num; stu *p,*p0; p=head; cinp; printf 請輸入要刪除的學號 :; scanf%d,# head=p-next; freep; return 1; p0=p-next; whilep0.=NUL

30、L ifp0-num=num p-next=p; freep0; return 1; p=p0; p0=p0-next; return 0; 更多精品文檔 第 16 頁,共 23 頁學習 - 好資料 /* 修改模塊 */ void revise_messagestu *h int choice,revise_num,flag; stu *p; p=head; do printfn 輸入要修改的同學的學號 :; scanf%d,&revise_num; whilep-num.=revise_num p=p-next; /* 查找 */ ifp-num=revise_num printfn -同學

31、信息 -n; printf-n; printf 學號 - 姓名 -性別 - 物理成果 - 數學成果 - 英語成果 - 運算機成果 n; printf%8s%4d%8s%8f%8f%8f%8f n,p-name,p-num,p-sex,p-physic,p-mathematic,p-english,p-computer; printfn 您要修改哪一項 .n; printfn 1,姓名 n; printfn 2,學號 n; printfn 3,性別 n; printfn 4 物理成果 n; printfn 5,數學成果 n; printfn 6,英語成果 n; printfn 7,運算機成果 n

32、; printfn 請選擇( 1-7) :; scanf%d,&choice; switchchoice case 1:printfn 輸入修改后的同學姓名 :; scanf%s,p-name;break; 更多精品文檔 第 17 頁,共 23 頁學習 - 好資料 case 2:printfn 輸入修改后的同學學號 :; scanf%d,p-num;break; case 3:printfn 輸入修改后的性別 :; scanf%s,&p-sex;case 4:printfn 輸入修改后的物理成果 :; scanf%f,&p-physic; case 5:printfn 輸入修改后的數學成果 :

33、; scanf%f,&p-mathematic; case 6:printfn 輸入修改后的英語成果 :; scanf%f,&p-english;break; case 7:printfn 輸入修改后的運算機成果 :; scanf%f,&p-computer;break; printf-n; printf 學號 - 姓名 - 性別 - 物理成果 - 數學成果 - 英語成果 - 運算機成果 n; printf%8s%4d%8s%8f%8f%8f%8f n,p-name,p-num,p-sex,p-physic,p-mathematic,p-english,p-computer; break; i

34、fp-next=NULL printfn 該同學不存在! ; printfnn 要連續(xù)嗎 .y/n; choice=getch; ifchoice=y|choice=Y printfn 連續(xù) .n; flag=1; else flag=0; whileflag=1;printfn 按任意鍵返回主菜單 .n; /* 更新模塊 */ 更多精品文檔 第 18 頁,共 23 頁學習 - 好資料 void renew_message int choice; do printfnn * 更新同學信息 *nn; printf 1.添加信息 nn; printf 2.刪除信息 nn; printf 3.修改信

35、息 nn; printf 4.返回主菜單 nn; printf 請選擇( 03) :; scanf%d,&choice; switchchoice case 1: insert;break; case 2: shanchu;break; case 3: revise_messagehead;break; case 0:;break; whilechoice.=0; /* 保留數據函數 */ void savestu *p2 FILE *fp; char file10; printfEnter file name; scanf%s,file; fp=fopenfile,w; whilep2.=N

36、ULL fprintffp,%s,p2-name; fprintffp,%d,p2-num; fprintffp,%s,p2-sex; fprintffp,%f,p2-physic; fprintffp,%f,p2-mathematic; fprintffp,%f,p2-english; fprintffp,%f,p2-computer; p2=p2-next; fclosefp; 更多精品文檔 第 19 頁,共 23 頁學習 - 好資料 /* 主函數 */ char password7=123456; void main /* 初始化 */ char choices; stu *p2; ch

37、ar s8; int flag=0,i; /* 標志項 */ int n=3; sum=read_message; do printfEnter password:n; scanf%s,s; if.strcmps,password printfPASSnnn; flag=1; break; else printf Error Enter againn; n-; whilen0; if.flag printfYou have Enter 3 times.; exit0; printf */ |*|n; /* printf|*|n; printf|-Welcome to the Mis-|n; printf |-* 歡迎進入界面 *-|n; 操作界面 | |n; printfprintf | Author (作者) :- |n; printf | Class班級 : - |n; 更多精品文檔

溫馨提示

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

評論

0/150

提交評論