版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、精選優(yōu)質(zhì)文檔-傾情為你奉上一、 課程設(shè)計目的 加深對C語言課程所學(xué)知識的理解,進一步鞏固C語言語法規(guī)則。學(xué)會編制結(jié)構(gòu)清晰、風(fēng)格良好、數(shù)據(jù)結(jié)構(gòu)適當(dāng)?shù)恼Z言程序,從而具備解決綜合性實際問題的能力, 使學(xué)生通過系統(tǒng)分析、系統(tǒng)設(shè)計、編程調(diào)試,寫實驗報告等環(huán)節(jié),初步掌握軟件系統(tǒng)設(shè)計的方法和步驟,訓(xùn)練靈活運用程序設(shè)計語言進行軟件開發(fā)的能力,提高分析問題和解決問題的能力,提高程序設(shè)計水平,培養(yǎng)必要的工程實踐動手能力二、課程設(shè)計內(nèi)容 學(xué)生學(xué)籍管理系統(tǒng)1, 輸入并驗證密碼;2, 設(shè)計菜單進行選擇相應(yīng)的操作;3, 用鏈表錄入并輸出數(shù)據(jù),包括學(xué)生的戶籍、成績、獎懲信息;4, 將錄入的數(shù)據(jù)存放在文件里面并讀取
2、文件;5, 對錄入的數(shù)據(jù)進行修改;6, 刪除個人信息;7, 查找個人信息;8, 對錄入的成績進行排序;9, 統(tǒng)計不及格的成績;10, 釋放鏈表;三、需求分析對所開發(fā)系統(tǒng)功能、性能的描述,想要實現(xiàn)的目標(biāo)。輸入并驗證密碼的正確性,定義結(jié)構(gòu)體類型來存放學(xué)生的基本信息(包括學(xué)生的姓名、學(xué)號、性別、出生日期等),然后建立鏈表存放信息,將信息存入文件中,以便以后的各個功能模塊調(diào)試時直接調(diào)用,對數(shù)據(jù)進行修改、刪除、查找、排序操作,然后對輸入的數(shù)據(jù)進行統(tǒng)計,查出不及格的學(xué)生成績。實現(xiàn)的目標(biāo)是對學(xué)生的學(xué)籍進行管理,更新并統(tǒng)計數(shù)據(jù)。 四、概要設(shè)計輸入數(shù)據(jù)函數(shù)輸出數(shù)據(jù)函數(shù)查找數(shù)據(jù)函數(shù)刪除數(shù)據(jù)函數(shù)輸 入 密 碼修改數(shù)
3、據(jù)函數(shù)主 菜 單保存文件函數(shù)讀取文件函數(shù)排序函數(shù)統(tǒng)計函數(shù)退出系統(tǒng)功能模塊說明:輸入密碼:從鍵盤輸入密碼,判斷輸入的密碼是否與系統(tǒng)設(shè)定的密碼相同,若相同則進入主菜單,不相同則繼續(xù)輸入; 主菜單:顯示系統(tǒng)的各項功能與相對應(yīng)的數(shù)字選項。輸入數(shù)據(jù)函數(shù):從鍵盤輸入數(shù)據(jù),并將數(shù)據(jù)存入鏈表。輸出數(shù)據(jù)函數(shù):對存儲的數(shù)據(jù)進行輸出。查找數(shù)據(jù)函數(shù):對存儲的數(shù)據(jù)進行查詢并顯示查詢結(jié)果。刪除數(shù)據(jù)函數(shù):對存入的數(shù)據(jù)進行刪除。修改數(shù)據(jù)函數(shù):對存入的數(shù)據(jù)進行修改。保存數(shù)據(jù)函數(shù):將從鍵盤輸入的數(shù)據(jù)存入到文件中讀取數(shù)據(jù)函數(shù):從文件中讀取個人信息。排序函數(shù):對平均成績進行排序并顯示排序結(jié)果統(tǒng)計函數(shù):對不及格成績進行統(tǒng)計并顯示統(tǒng)計結(jié)
4、果。退出系統(tǒng):退出系統(tǒng)五、詳細(xì)設(shè)計及運行結(jié)果流程圖錯誤 判斷正確性主菜單正確 修改數(shù)據(jù)是選擇5選擇1選擇3選擇2選擇4否否否否是是是是從鍵盤輸入數(shù)據(jù)并存入鏈表輸出數(shù)據(jù)查找個人信息刪除數(shù)據(jù)否是保存文件選擇6否是讀取文件選擇7否 是對成績進行排序選擇8否是統(tǒng)計不合格的成績選擇9選擇0退出六、調(diào)試情況,設(shè)計技巧及體會 通過兩周的課程設(shè)計,我對學(xué)過的C語言基本知識進行了鞏固,并且還對知識進行了擴展。在本次實習(xí)時,剛開始完全沒有頭緒,不知道從何入手,感覺難度很大.但是逐漸開始編寫程序慢慢發(fā)現(xiàn),原來不是想象中的那么難.在一個個模塊成功編寫出來的同時,獲得了巨大的成就感,并且掌握的許多上課遺漏和不很了解的知
5、識.。對一些細(xì)節(jié)以前不太注意,常常忽略,真正操作起來時發(fā)現(xiàn)一些小問題也會導(dǎo)致程序無法進行。要想運行正常,必須保證零錯誤。 同時,這兩周的實習(xí)使我對鏈表更熟悉了。以前總感覺鏈表很難,這次程序設(shè)計中,我用鏈表存取數(shù)據(jù),并進行刪除修改等操作,慢慢對鏈表熟悉。另外,在程序運行編譯的過程中出現(xiàn)一些錯誤,需要耐心的去檢查錯誤,調(diào)試程序。七、參考文獻C語言程序設(shè)計 譚浩強 清華大學(xué)出版社C語言程序設(shè)計教程 張毅坤 曹錳 張亞玲 西安交通大學(xué)出版社C語言程序設(shè)計 王曙燕 曹錳 科學(xué)出版社 #include <conio.h>#include <dos.h>#include <st
6、dio.h>#include <stdlib.h>#include <malloc.h>#include <math.h>#include <string.h>#define LEN sizeof(struct student)typedef struct int year; int month; int day; DATE; struct student int num; char name10; char sex; DATE birthday; int math; int C; int physic; int English; floa
7、t average; DATE time; char reason50; char result50; char unit50; struct student *next;struct student * read_file(); /*讀取文件*/void save_file(); /*保存*/void input(); /*創(chuàng)建鏈表,輸入數(shù)據(jù)*/void output(struct student *head); /*輸出*/void seek(struct student *h); /*查找*/void del() ; /*刪除*/void change (); /*修改*/void so
8、rt() ; /*對成績進行排序*/void summarise(); /*對不及格成績進行統(tǒng)計*/void free_linklist(void); /*釋放鏈表*/void print(struct student *p); /*輸出函數(shù)*/void menu(); /*菜單*/void password(); /*密碼*/struct student *head=NULL;int number=0;main() password(); getch(); system("cls"); printf("nnnnnttt*歡迎進入學(xué)生學(xué)籍管理系統(tǒng)*nnn"
9、;); getch(); menu();void password() char s8,ch; int i; s0='0's1='4' s2='0' s3='8' ; s4='2' s5='0' s6='4' s7='1' ; printf("nnnnnttt*nn"); printf("ttt*nn"); printf("ttt*nnnnn"); do printf("ttttplease inp
10、ut password: nttttt"); for(i=0;i<8;i+) ch=getch(); if(ch!=si) break; printf("*"); printf("nn"); if(i!=8) printf("It's error!n"); printf("please input again!n"); else break; while(1);void menu() int select=-1; head=NULL; while (select!=0) system(&qu
11、ot;cls"); printf("ttt*n"); printf("ttt *1 Input n"); printf("ttt *2 Output n"); printf("ttt *3 seek n"); printf("ttt *4 delete n"); printf("ttt *5 change n"); printf("ttt *6 save n"); printf("ttt *7 read n"); printf
12、("ttt *8 sort n"); printf("ttt *9 summarise n"); printf("ttt *0 Exit n"); printf("ttt*n"); printf("Please input select(0-8):"); scanf("%d",&select); switch(select) case 1: input(); break; case 2: output( head); break; case 3: seek(head)
13、; break; case 4: del(); break; case 5: change(); break; case 6: save_file(); break; case 7: head=read_file(); break; case 8: sort(); break; case 9: summarise(); break; case 0: free_linklist(); break; void input() /*創(chuàng)建鏈表,輸入數(shù)據(jù)*/ struct student *p1,*p2; p1=(struct student *)malloc (LEN); printf ("
14、please input the student's information:n"); printf ("address information:n"); printf ("num name sex year month day n"); scanf("%d", &p1->num); fflush(stdin); scanf ("%s",p1->name); fflush(stdin); scanf ("%c",&p1->sex); fflus
15、h(stdin); scanf ("%d%d%d",&p1->birthday.year,&p1->birthday.month,&p1->birthday.day); printf ("score information:n"); printf ("math C physic Englishn"); scanf ("%d%d%d%d",&p1->math,&p1->C,&p1->physic,&p1->English
16、); p1->average=(float)(p1->math+p1->C+p1->physic+p1->English)/4; printf(" rewards and punishments:n"); printf (" time(year month day )n"); scanf ("%d%d%d",&p1->time.year,&p1->time.month,&p1->time.day); printf ("reason: "); f
17、flush(stdin); scanf ("%s",p1->reason); printf ("result: "); fflush(stdin); scanf ("%s",p1->result); printf ("unit: "); fflush(stdin); scanf ("%s",p1->unit); p1->next=NULL; number+; if(head=NULL) head=p1; else p2=head; while (p2->next )
18、 p2=p2->next; p2->next=p1; getch();void output(struct student *head) /*輸出鏈表*/ struct student *p; int kind,flag=1; char choice='a' if (head=NULL) printf("Not Input before!n"); getch(); return; while (flag) printf ("students' information input before as fowllow:n"
19、); printf ("1:address; 2:score; 3:rewards and punishments 0:exitn"); printf ("please choice: "); scanf ("%d",&kind); p=head; do switch(kind) case 1: printf ("address information:n"); printf ("num name sex year month day n"); printf ("%d %s %
20、c ",p->num,p->name,p->sex); printf (" %d %d %dn",p->birthday.year,p->birthday.month,p->birthday.day); break; case 2: printf ("score information:n"); printf ("num name math C physic English averagn"); printf ("%d %s %d %d %d %d ",p->nu
21、m ,p->name , p->math,p->C,p->physic,p->English); printf ("%2.2fn",p->average); break; case 3: printf(" rewards and punishments:"); printf ("num : %d name %s n",p->num,p->name); printf ("time: year/%d month/%d day/%d n",p->time.year,p
22、->time.month,p->time.day); printf("reason: %sn",p->reason); printf("result: %sn",p->result); printf ("unit: %sn",p->unit); break; p=p->next; while(p); printf ("continue to choice (y/n) "); fflush(stdin); choice=getchar(); if(choice='n'
23、;) flag=0; printf("Display finish!n"); getch();void seek(struct student *h) /*查找鏈表*/ struct student *p; int seeknum; printf ("please input the num what you look for :"); scanf ("%d",&seeknum); p=h; while (p&&seeknum!=p->num) p=p->next; if(!p) printf (&
24、quot;the num you look for don't exist!n"); else print(p); getch();void del () /*刪除鏈表*/ int delnum; struct student *p1,*p2; p1=head; printf("input delete num:n"); scanf("%d",&delnum); while (delnum!=p1->num&&p1->next!=NULL) p2=p1; p1=p1->next; if (del
25、num=p1->num) if (p1=head) head=p1->next; else p2->next=p1->next; printf ("the student's information you input have been deleted!n"); number-; else printf ("the student you what to delete don't exist!n"); getch();void change() /*修改鏈表*/ int changenum,kind; int c
26、hoice,flag=1; char select=1; struct student *p; p=head; while (flag!=0) printf ("please input the num you want to change:n"); scanf ("%d",&changenum); while (changenum!=p->num) p=p->next; if (changenum=p->num) printf ("input the new information:n"); printf
27、("1:address ; 2:score ;3: rewards and punishments; 0:exit;n"); printf("input the kind you want to change:"); fflush(stdin); scanf("%d",&kind); switch(kind) case 1: printf ("1: name; 2:sex; 3:birthday;"); printf ("please choice :"); fflush(stdin);
28、 scanf ("%d",&choice); switch (choice) case 1: printf ("input the new name:"); fflush(stdin); scanf ("%s",p->name); break; case 2: printf ("input the new sex:"); fflush(stdin); scanf("%c",&p->sex); break; case 3: printf ("input the
29、 new birthday:"); fflush(stdin); scanf("%d%d%d",&p->birthday.year,&p->birthday.month,&p->birthday.day); break; break; case 2: printf ("1:math; 2:C; 3: physics; 4:English;"); printf ("please choice :"); fflush(stdin); scanf ("%d",&
30、choice ); switch (choice) case 1: printf ("input the new math:"); fflush(stdin); scanf ("%d",&p->math); break; case 2: printf ("input the new C:"); fflush(stdin); scanf ("%d",&p->C); break; case 3: printf ("input the new physic:"); fflu
31、sh(stdin); scanf ("%d",&p->physic); break; case 4: printf ("input the new English:"); fflush(stdin); scanf ("%d",&p->English); break; break; case 3: printf ("1: time; 2:reson; 3: result; 4: unit;"); printf ("please choice:"); fflush(std
32、in); scanf ("%d",&choice); switch (choice) case 1: printf ("input the new time:"); fflush(stdin); scanf ("%d%d%d",&p->time.year,&p->time.month,&p->time.day); break; case 2: printf ("input the new reason:"); fflush(stdin); scanf ("
33、%s",p->reason); break; case 3: printf (" input the new result :"); fflush(stdin); scanf ("%s",p->result); break; case 4: printf ("input the new unit:"); fflush(stdin); scanf ("%s",p->unit); break; else printf ("the num you want to change don
34、't exist!n"); printf(" continue to change ?(y/n)"); fflush(stdin); select=getchar(); if(select='n') flag=0; else printf ("continue!n"); print(p); getch();void save_file() /*保存文件*/ FILE *fp; struct student *stu; char filename10; printf ("input infile name:n&q
35、uot;); scanf ("%s",filename); if (fp=fopen(filename,"wb+")=NULL) printf ("cannot open file!"); exit(0); stu=head; do if(fwrite(stu,LEN,1,fp)!=1) printf ("file write error!"); stu=stu->next; while(stu); printf ("the file has been kept!n"); fclose (
36、fp); getch();struct student * read_file() /*讀取文件*/ FILE *fp; char filename10; struct student *p,*head=NULL,*stu; printf ("please input filename:n"); scanf("%s",filename); if (fp=fopen(filename,"rb+")=NULL) printf ("the file don't exist!"); exit(0); stu=p=(
37、struct student *) malloc(LEN); if(head=NULL) fread(stu,LEN,1,fp); head=stu; while (p->next!=NULL) p->next=stu; p=stu; stu=(struct student *) malloc(LEN); fread(stu,LEN,1,fp); p->next=NULL; fclose (fp); printf("read sucess!n"); return (head); getch();void print(struct student *p) /
38、*輸出*/ printf ("the new information is:n"); printf ("address information:n"); printf ("num: %d name %s sex %cn" ,p->num ,p->name ,p->sex); printf ("year: %d month %d day %d n",p->birthday.year,p->birthday.month,p->birthday.day); printf ("
39、score information:n"); printf ("math: %d C: %d physic: %d English: %d ",p->math,p->C,p->physic,p->English); printf(" average: %2.2f n",p->average); printf(" rewards and punishments:n"); printf ("time: year/%d month/%d day/%d n",p->time.y
40、ear,p->time.month,p->time.day); printf("reason: %sn",p->reason); printf("result: %sn",p->result); printf ("unit: %sn",p->unit);void sort() /*對成績進行排序*/ int i=0,j,k,n=0; struct student stu50,t,*p; head=read_file(); for(p=head;p;p=p->next) stui.num =p->
41、;num ; strcpy(,p->name ); stui.math =p->math ; stui.C =p->C ; stui.physic =p->physic ; stui.English =p->English ; stui.average =p->average ; i+; n+; for(j=0;j<n;j+) for(k=j+1;k<n-1;k+) if(stuj.average<stuk.average) t=stuj; stuj=stuk; stuk=t; for(i=0;i<n;i+) printf("No: %dn",i+1); printf("num name math C physic English averagen"); printf("%d %s %d %d %d %d %2.2fn",stui.num, ,stui.math,stui.C,stui.physic,stui.English,stui.average); getch();void summarise() /*對不及格成績進行統(tǒng)計*/ struct
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 年出欄商品肉豬10000頭環(huán)評報告
- 衛(wèi)生與消毒管理制度
- 衛(wèi)生院消毒滅菌管理制度
- 沒嚴(yán)格衛(wèi)生管理制度
- 水廠衛(wèi)生清掃制度
- 燒臘間衛(wèi)生管理制度
- 衛(wèi)生協(xié)管第一責(zé)任人制度
- 煤礦澡堂衛(wèi)生制度
- 口腔手衛(wèi)生管理制度
- 銅陵市衛(wèi)生管理制度
- 人機共智?創(chuàng)變未來:千夢引擎AI內(nèi)容營銷白皮書
- 2026年及未來5年市場數(shù)據(jù)中國帶電作業(yè)機器人行業(yè)市場需求預(yù)測及投資規(guī)劃建議報告
- 2026年杭州職業(yè)技術(shù)學(xué)院單招職業(yè)技能測試題庫附答案解析
- 北京市豐臺區(qū)2026屆(年)高三年級(上)學(xué)期期末考試英語試題卷+答案
- 別克英朗說明書
- 地下管線測繪課件
- 珍稀植物移栽方案
- 新人教版數(shù)學(xué)三年級下冊預(yù)習(xí)學(xué)案(全冊)
- GB/T 34336-2017納米孔氣凝膠復(fù)合絕熱制品
- GB/T 20077-2006一次性托盤
- GB/T 10046-2008銀釬料
評論
0/150
提交評論