




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、c語(yǔ)言課程設(shè)計(jì)目 錄1、需求分析;2、系統(tǒng)總框圖;3、每個(gè)模塊的設(shè)計(jì)分析;4、列出所有定義的函數(shù)及說(shuō)明;5、舉例說(shuō)明1、2個(gè)比較有特點(diǎn)的算法;6、數(shù)據(jù)分析。完備性、健壯性等;7、存在的問(wèn)題與不足及對(duì)策;8、使用說(shuō)明(操作手冊(cè));9、學(xué)習(xí)心得前 言計(jì)算機(jī)科學(xué)技術(shù)的發(fā)展,不僅極大地促進(jìn)了整個(gè)科學(xué)技術(shù)的發(fā)展,而且明顯地加快了經(jīng)濟(jì)信息化和社會(huì)信息化的進(jìn)程。因此,計(jì)算機(jī)教育在全國(guó)備受重視,計(jì)算機(jī)知識(shí)與能力已成為21世紀(jì)人才素質(zhì)的基本要素之一。如今,高等教育的計(jì)算機(jī)教育發(fā)展十分迅速。十多年前,只有部分理工科專業(yè)開(kāi)設(shè)計(jì)算機(jī)課程。今天,幾乎所有高校的所有專業(yè)都開(kāi)設(shè)了程度不同的計(jì)算機(jī)課程。人們已經(jīng)認(rèn)識(shí)到,計(jì)算機(jī)
2、知識(shí)已成為當(dāng)代知識(shí)分子知識(shí)結(jié)構(gòu)中不可缺少的重要組成部分。而除了掌握計(jì)算機(jī)的基礎(chǔ)知識(shí)和操作的基本能力外,掌握一門(mén)高級(jí)編程語(yǔ)言,并可以熟練運(yùn)用它,已成為當(dāng)代大學(xué)生綜合能力必要組成。計(jì)算機(jī)技術(shù)發(fā)展如此迅猛,計(jì)算機(jī)應(yīng)用如此廣泛,需要學(xué)習(xí)的東西愈來(lái)愈多,而我們的總學(xué)時(shí)是有限的。一般來(lái)說(shuō),計(jì)算機(jī)課程學(xué)習(xí)可以分為兩部分:一部分是理論課程學(xué)習(xí),一部分是上機(jī)應(yīng)用實(shí)習(xí)。根據(jù)我們專業(yè)的性質(zhì)和要求,則應(yīng)側(cè)重于上機(jī)操作運(yùn)用。為此,學(xué)校特意在暑期最后一星期安排了32個(gè)學(xué)時(shí)的上機(jī)實(shí)習(xí)?,F(xiàn)將一星期的實(shí)習(xí)內(nèi)容及結(jié)果分析分列如下:簡(jiǎn)單的行編輯器一 題目要求1 設(shè)置一個(gè)簡(jiǎn)單的行編輯器,每行以回車結(jié)束。2 數(shù)據(jù)以文件形式存儲(chǔ)。3 編
3、輯器具有查找,替代,修改數(shù)據(jù)的功能。二 需求分析根據(jù)題目要求,數(shù)據(jù)以文件的形式存儲(chǔ),所以應(yīng)提供文件的輸入,輸出等操作;還需要文件具有查找,替換,修改數(shù)據(jù)的功能。三 總體設(shè)計(jì)根據(jù)上面的需求分析,可以將這個(gè)系統(tǒng)的設(shè)計(jì)分為如下七大模塊:編輯,查找,修改,刪除,替換,保存,退出。簡(jiǎn)單的行編輯器系統(tǒng)編輯替換刪除修改保存退出查找四 詳細(xì)設(shè)計(jì)1 主函數(shù)為了各模塊的獨(dú)立性,主函數(shù)一般設(shè)計(jì)得比較簡(jiǎn)單,本系統(tǒng)主要用主函數(shù)打開(kāi)上次保存的數(shù)據(jù)和進(jìn)入主菜單函數(shù)流程圖main()file *fp;fp=fopen(record.txt,w);/*在c:documents and settingsadministrator
4、里建立一個(gè)record.txt記事本*/fclose(fp);menu();打開(kāi)上次保存文件進(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;/*查找過(guò)期的訂戶記錄并刪除*/ case 3:statistic();break;/*統(tǒng)計(jì)*/ case 4:exit();break;/*退出*/ 顯示一系列功能選項(xiàng)輸入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)計(jì)模塊*/ 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)/*顯示一個(gè)儀器記錄的函數(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個(gè)儀器記錄的函數(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)用顯示一個(gè)儀器記錄的函數(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)/*以只寫(xiě)方式打開(kāi)*/ 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);/*把符合條件的記錄顯示出來(lá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()/*加載儀器信息并計(jì)算記錄儀器個(gè)數(shù)的函數(shù)*/file *fp;int i; if(fp=fopen(record.txt,r)=null)/*以只讀方式打開(kāi)*/ 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表示保存在哪個(gè)文件夾里*/file *fp;int i;fp=fopen(record.txt,w);/*以只寫(xiě)方式打開(kāi)*/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里建立一個(gè)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;/*查找過(guò)期的訂戶記錄并刪除*/ case 3:statistic();break;/*統(tǒng)計(jì)*/ 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)計(jì)模塊*/ 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)/*顯示一個(gè)儀器記錄的函數(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個(gè)儀器記錄的函數(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)用顯示一個(gè)儀器記錄的函數(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)/*以只寫(xiě)方式打開(kāi)*/ 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);/*把符合條件的記錄顯示出來(lái)*/ printf(nnthe record is out of date!); printf(nndo you want to delete its information?(yorn
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 羅密歐與朱麗葉-第二幕
- 九九重陽(yáng)節(jié)的演講稿15篇
- 桓臺(tái)疫情募捐活動(dòng)方案
- 橘皮貼畫(huà)活動(dòng)方案
- 梨花拍攝活動(dòng)方案
- 桂林校園讀書(shū)日活動(dòng)方案
- 漢服取名活動(dòng)方案
- 月末盲人推拿活動(dòng)方案
- 服裝代理活動(dòng)方案
- 春節(jié)眼科活動(dòng)方案
- 2025年長(zhǎng)沙市中考數(shù)學(xué)試卷真題(含標(biāo)準(zhǔn)答案)
- 2025年北京市中考數(shù)學(xué)試卷真題
- 教育政策執(zhí)行情況調(diào)查報(bào)告范文
- 醫(yī)院設(shè)備采購(gòu)方案(3篇)
- 2025至2030中國(guó)智能物流行業(yè)發(fā)展趨勢(shì)分析與未來(lái)投資戰(zhàn)略咨詢研究報(bào)告
- 2024年武漢市漢陽(yáng)區(qū)招聘社區(qū)干事考試真題
- 2025年臺(tái)江礦泉水分公司招聘筆試參考題庫(kù)含答案解析
- 涉密測(cè)繪成果管理制度
- 廣告項(xiàng)目方案投標(biāo)文件(技術(shù)方案)
- 北師大版4四年級(jí)下冊(cè)數(shù)學(xué)期末復(fù)習(xí)試卷(5套)
- 遼寧省大連市甘井子區(qū)2023-2024學(xué)年七年級(jí)下學(xué)期期末生物學(xué)試題(原卷版)
評(píng)論
0/150
提交評(píng)論