




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、c語言課程設(shè)計目 錄1、需求分析;2、系統(tǒng)總框圖;3、每個模塊的設(shè)計分析;4、列出所有定義的函數(shù)及說明;5、舉例說明1、2個比較有特點的算法;6、數(shù)據(jù)分析。完備性、健壯性等;7、存在的問題與不足及對策;8、使用說明(操作手冊);9、學(xué)習(xí)心得前 言計算機科學(xué)技術(shù)的發(fā)展,不僅極大地促進(jìn)了整個科學(xué)技術(shù)的發(fā)展,而且明顯地加快了經(jīng)濟(jì)信息化和社會信息化的進(jìn)程。因此,計算機教育在全國備受重視,計算機知識與能力已成為21世紀(jì)人才素質(zhì)的基本要素之一。如今,高等教育的計算機教育發(fā)展十分迅速。十多年前,只有部分理工科專業(yè)開設(shè)計算機課程。今天,幾乎所有高校的所有專業(yè)都開設(shè)了程度不同的計算機課程。人們已經(jīng)認(rèn)識到,計算機
2、知識已成為當(dāng)代知識分子知識結(jié)構(gòu)中不可缺少的重要組成部分。而除了掌握計算機的基礎(chǔ)知識和操作的基本能力外,掌握一門高級編程語言,并可以熟練運用它,已成為當(dāng)代大學(xué)生綜合能力必要組成。計算機技術(shù)發(fā)展如此迅猛,計算機應(yīng)用如此廣泛,需要學(xué)習(xí)的東西愈來愈多,而我們的總學(xué)時是有限的。一般來說,計算機課程學(xué)習(xí)可以分為兩部分:一部分是理論課程學(xué)習(xí),一部分是上機應(yīng)用實習(xí)。根據(jù)我們專業(yè)的性質(zhì)和要求,則應(yīng)側(cè)重于上機操作運用。為此,學(xué)校特意在暑期最后一星期安排了32個學(xué)時的上機實習(xí)?,F(xiàn)將一星期的實習(xí)內(nèi)容及結(jié)果分析分列如下:簡單的行編輯器一 題目要求1 設(shè)置一個簡單的行編輯器,每行以回車結(jié)束。2 數(shù)據(jù)以文件形式存儲。3 編
3、輯器具有查找,替代,修改數(shù)據(jù)的功能。二 需求分析根據(jù)題目要求,數(shù)據(jù)以文件的形式存儲,所以應(yīng)提供文件的輸入,輸出等操作;還需要文件具有查找,替換,修改數(shù)據(jù)的功能。三 總體設(shè)計根據(jù)上面的需求分析,可以將這個系統(tǒng)的設(shè)計分為如下七大模塊:編輯,查找,修改,刪除,替換,保存,退出。簡單的行編輯器系統(tǒng)編輯替換刪除修改保存退出查找四 詳細(xì)設(shè)計1 主函數(shù)為了各模塊的獨立性,主函數(shù)一般設(shè)計得比較簡單,本系統(tǒng)主要用主函數(shù)打開上次保存的數(shù)據(jù)和進(jìn)入主菜單函數(shù)流程圖main()file *fp;fp=fopen(record.txt,w);/*在c:documents and settingsadministrator
4、里建立一個record.txt記事本*/fclose(fp);menu();打開上次保存文件進(jìn)入主菜單函數(shù)程序/*主函數(shù)*/2 主菜單函數(shù)流程圖程序void menu()int w,n;doclrscr();printf(n);printf(tt* * * * * * * * * * * * * * * * * * * * * * * * *n);printf(tt n);printf(tt n);printf(tt welcome to the magazine order system !_ n);printf(tt n);printf(tt n);printf(tt* * * * * *
5、 * * * * * * * * * * * * * * * * * * *n);printf(nntt *nn);printf(tt 1:add_new_subscribern);printf(tt 2:browsen);printf(tt 3:statisticn);printf(tt 4:exitnn);printf(tt *nn);printf( choice your number(1-4): bb);scanf(%d,&n);if(n4) w=1;else w=0;while (w=1);/*選擇功能*/switch(n) case 1:add();break;/*增加新訂戶記錄*
6、/ case 2:search();break;/*查找過期的訂戶記錄并刪除*/ case 3:statistic();break;/*統(tǒng)計*/ case 4:exit();break;/*退出*/ 顯示一系列功能選項輸入n,判斷n是否是0-6根據(jù)n的值調(diào)用各功能模塊函數(shù)是否3. 各功能模塊函數(shù)1)/*添加模塊*/void add()int t,i,m;clrscr();t=load_record();printf(how many groups information do you want to add?n);printf(enter the number: bbb);scanf(%d,&
7、m);for(i=0;im;i+)printf(ninput %dth subscriber record.n,i+1);input(t+i);/*調(diào)用輸入函數(shù)*/save(t+m);/*調(diào)用保存函數(shù) 保存t+m組數(shù)據(jù)*/clrscr();/*清屏*/menu();/*返回登陸界面*/void input(int i)printf(please input:nname sex address phone_number unit_price amount time_ imit n);scanf(%s%s%s%s%s%s%s,&,&orderi.sex,&orderi.add
8、r,&orderi.phone_number,&orderi.unit_price,&orderi.amount,&orderi.time_limit);2)/*統(tǒng)計模塊*/ statistic()int t;t=load_record();printf(the amount of subscriber is%dbbb,t);printf_n(t);printf(nnnpress any key to go back.nn);getch();menu();void printf_one(int i)/*顯示一個儀器記錄的函數(shù)*/printf(%-10s %-5s %-10s %-11s %-4
9、s %-3s %-10snn,,orderi.sex,orderi.addr,orderi.phone_number,orderi.unit_price,orderi.amount,&orderi.time_limit);void printf_n(int n)/*顯示n個儀器記錄的函數(shù)*/int j;clrscr();/*清屏*/printf(name sex address phone_number price amount time_ imitnn);for(j=0;jn;j+) if(j+1)%10=0)/*控制顯示,每屏顯示10行*/ printf(nnpass
10、 any key to continue .); getch(); puts(nn); printf_one(j);/*調(diào)用顯示一個儀器記錄的函數(shù)*/ 3)/*查詢模塊*/void search()file *fp;char date11,str2;int t,i,sum=0;t=load_record();clrscr();printf(please input the date: bbbbbbbbbbb);scanf(%s,date);printf(n);if(fp=fopen(record.txt,w)=null)/*以只寫方式打開*/ printf(ncannot open filen
11、); exit(0); clrscr();printf(n); for(i=0;it;i+) if(strcmp(orderi.time_limit,date)0) sum+; printf(n); printf_one(i);/*把符合條件的記錄顯示出來*/ printf(nnthe record is out of date!); printf(nndo you want to delete its information?(yorn): bb); scanf(%s,str); if(strcmp(str,y)=0|strcmp(str,y)=0) continue; fwrite(&or
12、deri,sizeof(struct magazine),1,fp); fclose(fp); if(sum=0) printf(*nn); printf(sorry! cannot find the equipment which you want to.nn); printf(*nn); printf(nnnpress any key to go back the former step.n); getch(); menu();各功能模塊查找行刪除行 printf(nnnpress any key to go back the former step.n);1 getch();4 )退出模
13、塊流程圖提示是否保存是否保存保存退出是否程序void myexit(char (*lines)maxc) char c; printf(save the lines to the file?(y/n); fflush(stdin); c=getchar(); if(c=n) exit(1); savetofile(lines); exit(1);4 公共函數(shù)int load_record()/*加載儀器信息并計算記錄儀器個數(shù)的函數(shù)*/file *fp;int i; if(fp=fopen(record.txt,r)=null)/*以只讀方式打開*/ printf(ncannot open fi
14、len); exit(0); for(i=0;!feof(fp);i+)/*從文件中讀入數(shù)據(jù)并保存在結(jié)構(gòu)體數(shù)組中*/fread(&orderi,sizeof(struct magazine),1,fp);fclose(fp);return(i-1);void save(int n)/*n表示保存n組數(shù)據(jù),m表示保存在哪個文件夾里*/file *fp;int i;fp=fopen(record.txt,w);/*以只寫方式打開*/if(fp=null)printf(ncannot open filen);exit(0);for(i=0;in;i+) fwrite(&orderi,sizeof(s
15、truct magazine),1,fp); fclose(fp); 綜上全程序如下#include#define max 20struct magazinechar name11;char sex6;char addr11;char phone_number12;char unit_price5;char amount4;char time_limit11;ordermax;void save(int n);int load_record();void search();void printf_n(int n);void printf_one(int i);void input(int i)
16、;statitic();void add();void menu();main()file *fp;fp=fopen(record.txt,w);/*在c:documents and settingsadministrator里建立一個record.txt記事本*/fclose(fp);menu();void menu()int w,n;doclrscr();printf(n);printf(tt* * * * * * * * * * * * * * * * * * * * * * * * *n);printf(tt n);printf(tt n);printf(tt welcome to t
17、he magazine order system !_ n);printf(tt n);printf(tt n);printf(tt* * * * * * * * * * * * * * * * * * * * * * * * *n);printf(nntt *nn);printf(tt 1:add_new_subscribern);printf(tt 2:browsen);printf(tt 3:statisticn);printf(tt 4:exitnn);printf(tt *nn);printf( choice your number(1-4): bb);scanf(%d,&n);if
18、(n4) w=1;else w=0;while (w=1);/*選擇功能*/switch(n) case 1:add();break;/*增加新訂戶記錄*/ case 2:search();break;/*查找過期的訂戶記錄并刪除*/ case 3:statistic();break;/*統(tǒng)計*/ case 4:exit();break;/*退出*/ /*添加模塊*/void add()int t,i,m;clrscr();t=load_record();printf(how many groups information do you want to add?n);printf(enter
19、the number: bbb);scanf(%d,&m);for(i=0;im;i+)printf(ninput %dth subscriber record.n,i+1);input(t+i);/*調(diào)用輸入函數(shù)*/save(t+m);/*調(diào)用保存函數(shù) 保存t+m組數(shù)據(jù)*/clrscr();/*清屏*/menu();/*返回登陸界面*/void input(int i)printf(please input:nname sex address phone_number unit_price amount time_ imit n);scanf(%s%s%s%s%s%s%s,&orderi.n
20、ame,&orderi.sex,&orderi.addr,&orderi.phone_number,&orderi.unit_price,&orderi.amount,&orderi.time_limit);/*統(tǒng)計模塊*/ statistic()int t;t=load_record();printf(the amount of subscriber is%dbbb,t);printf_n(t);printf(nnnpress any key to go back.nn);getch();menu();void printf_one(int i)/*顯示一個儀器記錄的函數(shù)*/printf(%
21、-10s %-5s %-10s %-11s %-4s %-3s %-10snn,,orderi.sex,orderi.addr,orderi.phone_number,orderi.unit_price,orderi.amount,&orderi.time_limit);void printf_n(int n)/*顯示n個儀器記錄的函數(shù)*/int j;clrscr();/*清屏*/printf(name sex address phone_number price amount time_ imitnn);for(j=0;jn;j+) if(j+1)%10=0)/*控制顯
22、示,每屏顯示10行*/ printf(nnpass any key to continue .); getch(); puts(nn); printf_one(j);/*調(diào)用顯示一個儀器記錄的函數(shù)*/ /*查詢模塊*/void search()file *fp;char date11,str2;int t,i,sum=0;t=load_record();clrscr();printf(please input the date: bbbbbbbbbbb);scanf(%s,date);printf(n);if(fp=fopen(record.txt,w)=null)/*以只寫方式打開*/ printf(ncannot open filen); exit(0); clrscr();printf(n); for(i=0;it;i+) if(strcmp(orderi.time_limit,date)0) sum+; printf(n); printf_one(i);/*把符合條件的記錄顯示出來*/ printf(nnthe record is out of date!); printf(nndo you want to delete its information?(yorn
溫馨提示
- 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 代銷意向合同范本
- 二手車線上交易合同范本
- 眾籌股東合同范本6
- 買賣帶表格合同范例
- 加工中心保養(yǎng)合同范本
- 兄弟共同承包土地合同范本
- 辦公電腦合同范本
- 代理執(zhí)行合同范本
- 共同買地皮合同范本
- pc吊裝合同范本
- 2025年海域使用權(quán)租賃合同
- 《走近世界民間美術(shù)》 課件 2024-2025學(xué)年人美版(2024)初中美術(shù)七年級下冊
- (2025春)人教版三年級數(shù)學(xué)下冊全冊教案
- 2025年江蘇省高職單招《職測》高頻必練考試題庫400題(含答案)
- 2025云南紅河州個舊市大紅屯糧食購銷限公司招聘及人員高頻重點模擬試卷提升(共500題附帶答案詳解)
- X證書失智老年人照護(hù)講解
- 工廠安全事故預(yù)防知識
- 2024-2025學(xué)年人教版數(shù)學(xué)八年級下冊期中檢測卷(含答案)
- 2024年江西應(yīng)用工程職業(yè)學(xué)院高職單招職業(yè)適應(yīng)性測試歷年參考題庫含答案解析
- 2025屆江蘇蘇州市四校高三12月聯(lián)考語文試題(教師版)
- 中醫(yī)護(hù)理技術(shù)操作質(zhì)量控制
評論
0/150
提交評論