C語言課程設計--學生考勤信息記錄系統(tǒng)_第1頁
C語言課程設計--學生考勤信息記錄系統(tǒng)_第2頁
C語言課程設計--學生考勤信息記錄系統(tǒng)_第3頁
C語言課程設計--學生考勤信息記錄系統(tǒng)_第4頁
C語言課程設計--學生考勤信息記錄系統(tǒng)_第5頁
已閱讀5頁,還剩24頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、C語言課程設計-學生考勤信息記錄系統(tǒng) 目 錄 設計目的 . 總體設計 詳細設計 調試與測試 總結與體會附:源程序清單和執(zhí)行結果.第1章 設計目的本次C語言課程設計是對本學期程序設計根底課程的實際應用,也算是對所學知識的一次檢驗,通過本次課程設計能到達的目的如下:1.穩(wěn)固和加深對C課程根本內容和理論知識的理解和掌握。2.掌握C語言編譯和程序調試的根本技能。3.利用C語言進行根本的程序設計從而逐步了解文件的一些相關操作和掌握函數的使用技巧,包括函數類型的選擇,含參數的傳遞方式。4.掌握使用數組,指針,引用,文件等編譯的方法,提高運用C語言解決實際問題的能力。5.通過對學生考勤系統(tǒng)的設計、編寫源代碼

2、,以及對C語言中各個語法和函數的使用,使得比照擬復雜的結構體、鏈接、文件的操作更加熟悉。6.通過課程設計,將本學期所學知識與實際應用聯(lián)系和結合起來,培養(yǎng)自己的動手能力,以及加強各學科之間的聯(lián)系,從而提高個人的團隊意識,增強團隊之間協(xié)調和配合第2章 總體設計通過該系統(tǒng)實現對學生考勤信息進行創(chuàng)立、錄入、修改、查詢、保存等操作的管理。實驗考勤信息包括學生姓名,學號,學科種類,各科的考勤信息。主要功能:1、能夠完成對考勤的錄入和修改2、創(chuàng)立一個班級的信息3、設備的查詢4、將考勤信息保存到文件中根據設計要求,畫出如下流程圖:void creat void ;void save struct Studen

3、t *,char ;struct Student *load char ;void enter void ; /*錄入函數*/void search_1 void ; /*查詢函數_1*/void search_2 void ; /*查詢函數_2*/void add void ;void modify void ; /*修改函數*/void back void ; /*退出函數*/void mune_1 ; /*界面-1*/void mune_2 ; /*界面-2*/mune_1 ;mune_2 ;第3章 詳細設計void mune_1 ; /*菜單函數1*/void mune_2 /*菜單函

4、數2*/ 1 2 3 4 5 6 Break Break Break Break Break break void enter void ; /*錄入函數*/ n void search_1 void ; /*查詢個人信息*/ 真 假void search_2 void ; /*查詢班級信息*/void modify void ; /*修改函數*/ 真 假void save struct Student *,char ;struct Student *load char filename Ifelse結構和 while 結構嵌套結構:while p1- num! 0 n n+1;if n 1

5、head p1;else p2- next p1;p2 p1;p1 struct Student * malloc LEN ; scanf "%s%d%s",p1- name,&p1- num,p1- sex ;p1- math p1- English p1- physics p1- Mks p1- C p1- teal p1- PE 0; p2- next NULL;p head;while p! NULL fwrite p,LEN,1,fp ;p p- next; fclose fp ;printf "ttt創(chuàng)立成功,按任意鍵返回主菜單n"

6、;getch ; system "cls" ;mune_2 ;2 switch結構switch sub case 1: p- math+ num; break;case 2: p- English+ num; break;case 3: p- physics+ num; break;case 4: p- Mks+ num; break;case 5: p- C+ num; break;case 6: p- teal+ num; break;case 7: p- PE+ num; break; 3while結構 while p! NULL if p- num a printf

7、 "ntt請重新輸入高等數學缺勤節(jié)數:" ; scanf "%d",&p- math ; printf "ntt請重新輸入大學英語缺勤節(jié)數:" ; scanf "%d",&p- English ; printf "ntt請輸入大學物理缺勤節(jié)數:" ; scanf "%d",&p- physics ; printf "ntt請重新輸入馬克思主義根本原理與概論缺勤節(jié)數:" ; scanf "%d",&p- M

8、ks ; printf "ntt請重新輸入C語言缺勤節(jié)數:" ; scanf "%d",&p- C ; printf "ntt請重新輸入英語口語缺勤節(jié)數:" ; scanf "%d",&p- teal ; printf "ntt請重新輸入體育缺勤節(jié)數目:" ; scanf "%d",&p- PE ; flag 1;save head,cla ; printf "ntt修改成功!ntt" ;break; p p- next; 第4章

9、調試與測試執(zhí)行程序時,顯示如下信息選擇不同的選項,執(zhí)行相應的功能。 選擇3 ,創(chuàng)立一個班級的根本信息。 選擇1 ,錄入本次課考勤情況。選擇要修改的科目的界面:輸入缺勤同學和缺勤節(jié)數:結束輸入那么輸入n后返回菜單2:選擇2,查詢學生個人考勤信息。選擇4,修改學生個人考勤信息。選擇5,查看一個班級的考勤信息。選擇6,退出學生考勤信息系統(tǒng)。第5章 總結與體會三周的課程設計已經結束了?;叵雽W習C語言 的過程中,既有快樂又有煩惱。從領到書的那一刻,我就很郁悶,?C 語言程序設計?到底事學什么的,有什么用。剛開始上課時,還在迷茫這門課程是用來做什么的。不過,這些感受都是在對這門課程不了解的情況下產生的。后

10、來慢慢的接觸多了,聽老師講的多了,了解多了,漸漸的產生了興趣。尤其是學到語句和函數時,上機操作程序,經過編譯,調試和運行后,出現界面,當時覺得很好奇,想真正的學好這門課程。通過半個學期的學習,我掌握了根本知識。下學期開始時,被通知要進行課程設計。當時有點懵,感覺學的東西很少,很零散,不知該怎么連到一起,就要課程設計,是不是太難為我們了。第一天根本上都是在看書,把根本知識再熟悉一遍。到了下午的時候,看了很多練習題,從這些練習題上我得到了不少啟發(fā),然后我們組把整個程序的思路理清了,開始著手寫程序。第一周結束的時候,我感覺自己收獲挺大的,從一開始的迷茫,不知道從何下手到把程序中的幾個模塊編寫出來,心

11、里挺開心的。但是,接下來,我們又不得不再次陷入困境。在整個程序的編寫過程中,最難的就是修改和刪除這兩個模塊,這也是我們要解決的重點問題。開始編寫修改和刪除時,很頭疼,去向其他人尋求幫助,在別人的幫助和提示下,我編完了修改程序,但編譯時老出錯,修改后的內容將文本內的信息全部覆蓋了。困難之時,我們組的其他人,幫助了我,完成了修改和刪除,這讓我認識到團隊的力量。這樣的話,整個程序根本上全部完成了,就剩下完善工作了。我們組寫了兩個程序,最后,兩個程序相互組合,互補,大功告成雖然設計時完成了,但是我覺得其中還是有一些缺乏之處:1. 警告句。程序中缺少一些警告句,例如:“是否真的刪除y/n?。2. 重名的

12、情況。由于考慮的不周全,沒有設計遇到重名的情況該怎么處理。3. 選擇單一。我們設計的程序中,只設計了按名字選擇,進行操作,忽略了重名的情況。整個程序完成了,還有很多不完善的地方,希望自己以后辦事的時候要認真,仔細,考慮周全。短短的幾周課程設計結束了,但是這段時間里,我又學到了更多C 知識,如:對象數組,string類,文件流,鏈表以及文件對鏈表的操作等,同時我也被提醒以后辦事的時候要認真,仔細,考慮周全,也看到了團隊精神和互幫互助的重要性。這一點會讓我終生受益。通過這次課程設計,我覺得自己肚子里的墨水多了,收獲也挺大的,這幾周過的挺充實!*附:源程序清單和執(zhí)行結果#include #inclu

13、de #include #include #define LEN sizeof struct Student struct Student int num;char name15;char sex4;int math, English,physics,Mks,C,teal,PE;struct Student *next; ;int n;void main void creat void ;void save struct Student *,char ;struct Student *load char ;void enter void ; /*錄入函數*/void search_1 void

14、 ; /*查詢函數_1*/void search_2 void ; /*查詢函數_2*/void modify void ; /*修改函數*/void back void ; /*退出函數*/void mune_1 ; /*界面-1*/void mune_2 ; /*界面-2*/mune_1 ;mune_2 ;printf "n" ; void mune_1 printf "nnnnnn" ; printf "t*" ; printf "ttt * * " ; printf "ttt* 歡 迎 使 用 班

15、 級 考 勤 系 統(tǒng) *" ; printf "ttt * * " ; printf "nt*nnn" ; printf " " ; printf "nnntttt nttttt" ; getch ; system "cls" ; void mune_2 int option,ch; /*定義一個選項的數據類型*/ printf "nnn" ; /*制作的一個漂亮的選擇界面*/printf "t*n" ;printf "t*tttttt

16、t *n" ;printf "t*ttttttt *n" ;printf "t* 1、錄入本次課考勤情況t 2、查詢學生考勤信息t *n" ;printf "t*ttttttt *n" ;printf "t* 3、創(chuàng)立學生信息tt 4、修改學生信息t *n" ;printf "t*ttttttt *n" ; printf "t* 5、查看班級考勤情況 t 6、退出考勤系統(tǒng)t *n" ;printf "t*ttttttt *n" ;printf &

17、quot;t*ttttttt *n" ;printf "t*n" ;printf "n" ;printf "ttt請輸入您所需的操作 16 :ntttt" ;while 1 scanf "%d",&option ;switch option case 1: ch getchar ;system "cls" ;enter ; break;case 2: ch getchar ;system "cls" ;search_1 ; break;case 3: ch

18、getchar ;system "cls" ;creat ; break;case 4: ch getchar ;system "cls" ;modify ; break;case 5: ch getchar ;system "cls" ;search_2 ; break;case 6: ch getchar ;system "cls" ;back ; break;default: printf "ttt輸入錯誤,請重新輸入!" ; printf "ntttt" ; ch g

19、etchar ; void save struct Student *head,char filename FILE *fp;struct Student *p head;if fp fopen filename,"wb" NULL printf "can not open filen" ;exit 0 ; while p! NULL fwrite p,LEN,1,fp ;p p- next; fclose fp ; struct Student *load char filename FILE *fp;struct Student *head,*p1,

20、*p2;head NULL;p1 NULL;if fp fopen filename,"rb" NULL printf "can not open filen" ;exit 0 ; while !feof fp p2 struct Student * malloc LEN ;if fread p2,LEN,1,fp 1 if head NULL head p2;if p1 p1- next p2;p1 p2; p1- next NULL;return head ; void enter /*錄入函數*/ struct Student *head,*p;c

21、har select 'y',cla10;int sub,stu,num,flag 0;printf "請輸入上課班級:" ;scanf "%s",cla ;strcat cla,".dat" ;p head load cla ;system "cls" ;while select 'y'|select 'Y' printf "nnn" ; printf "t* * * * * * * * * * * * * * * * * * * *

22、* * * * * * * * * * * *n" ; printf "t*ttttttt *n" ; printf "t*ttttttt *n" ; printf "t* 1、高等數學tt 2、大學英語tt *n" ; printf "t*ttttttt *n" ; printf "t* 3、大學物理tt 4、馬克思根本原理概論 *n" ; printf "t*ttttttt *n" ; printf "t* 5、C程序設計根底 t 6、教師口語tt *

23、n" ; printf "t*ttttttt *n" ; printf "t* 7、體育tttttt *n" ; printf "t*ttttttt *n" ; printf "t*ttttttt *n" ; printf "t* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n" ; printf "n" ;printf "ttt請輸入科目選項 17 :ntttt" ;

24、scanf "%d",&sub ;while 1 if sub 0&&sub 8 break;elseprintf "ttt輸入錯誤,請重新輸入ntttt" ;scanf "%d",&sub ; system "cls" ; printf "請輸入本次課缺席同學的座號:" ; scanf "%d",&stu ; printf "n" ; printf "請輸入該同學的缺課節(jié)數:" ; scanf

25、"%d",&num ;while p! NULL if p- num stu switch sub case 1: p- math+ num; break;case 2: p- English+ num; break;case 3: p- physics+ num; break;case 4: p- Mks+ num; break;case 5: p- C+ num; break;case 6: p- teal+ num; break;case 7: p- PE+ num; break; p p- next; printf "nntt*輸入成功*!n&qu

26、ot; ;printf "是否繼續(xù)輸入 yn :" ;scanf "%c",&select ; save head,cla ;getch ; system "cls" ;mune_2 ; void search_1 void /*查詢個人信息*/ struct Student *head,*p;char select 'y',cla10;int num,flag 0;printf "請輸入上課班級:" ;scanf "%s",cla ;strcat cla,".

27、dat" ;p head load cla ;printf "請輸入要查詢同學的座號:" ;scanf "%d",&num ;system "cls" ;while p! NULL if p- num num printf "nn" ;printf "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n" ;printf " 座號 姓名 性別 數學 英語 物理

28、馬克思 C語言 教師口語 體育n" ;printf " %3d %8s %4s%5d %5d %5d %5d %3d %7d %8dn",p- num,p- name,p- sex,p- math,p- English,p- physics,p- Mks,p- C,p- teal,p- PE ;printf "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n" ;flag 1; p p- next; if flag 0 printf

29、"tt!沒有這個學生信息,請核對后再輸入!nn" ;getch ; system "cls" ;mune_2 ; void search_2 void /*查詢某班級信息*/ char cla10;struct Student *head,*p;printf "請輸入您要查詢的班級名:" ;gets cla ;system "cls" ;printf "n ttt%s班的考勤情況nn",cla ;strcat cla,".dat" ;p head load cla ;prin

30、tf "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n" ;printf " 座號 姓名 性別 數學 英語 物理 馬克思 C語言 教師口語 體育n" ;while p! NULL printf " %3d %8s %4s%5d %5d %5d %5d %3d %7d %8dn",p- num,p- name,p- sex,p- math,p- English,p- physics,p- Mks,p- C,p- teal,p

31、- PE ;p p- next; printf "n* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *n" ;getch ; system "cls" ;mune_2 ; void modify void /*修改函數*/ int a,flag 0;char cla10; struct Student *head,*p;printf "ntt請輸入要修改的班級:" ;scanf "%s",cla ;strca

32、t cla,".dat" ;p head load cla ; printf "ntt請輸入要修改的學生的座號:" ; scanf "%d",&a ;while p! NULL if p- num a printf "ntt請重新輸入高等數學缺勤節(jié)數:" ; scanf "%d",&p- math ; printf "ntt請重新輸入大學英語缺勤節(jié)數:" ; scanf "%d",&p- English ; printf "

33、;ntt請輸入大學物理缺勤節(jié)數:" ; scanf "%d",&p- physics ; printf "ntt請重新輸入馬克思主義根本原理與概論缺勤節(jié)數:" ; scanf "%d",&p- Mks ; printf "ntt請重新輸入C語言缺勤節(jié)數:" ; scanf "%d",&p- C ; printf "ntt請重新輸入英語口語缺勤節(jié)數:" ; scanf "%d",&p- teal ; printf &

34、quot;ntt請重新輸入體育缺勤節(jié)數目:" ; scanf "%d",&p- PE ; flag 1;save head,cla ; printf "ntt修改成功!ntt" ;break; p p- next; if flag 0 printf "tt!沒有這個學生信息,請核對后再輸入!nn" ; getch ; system "cls" ; mune_2 ; void creat void /*創(chuàng)立函數*/ FILE *fp; struct Student *head,*p,*p1,*p2;char file

溫馨提示

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

評論

0/150

提交評論