C語(yǔ)言版數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)文章編輯系統(tǒng)_第1頁(yè)
C語(yǔ)言版數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)文章編輯系統(tǒng)_第2頁(yè)
C語(yǔ)言版數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)文章編輯系統(tǒng)_第3頁(yè)
C語(yǔ)言版數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)文章編輯系統(tǒng)_第4頁(yè)
C語(yǔ)言版數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)文章編輯系統(tǒng)_第5頁(yè)
已閱讀5頁(yè),還剩11頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、課程設(shè)計(jì)說(shuō)明書(shū) no.1文章編輯系統(tǒng)1、課程設(shè)計(jì)目的(1)較熟練地掌握語(yǔ)言的基本內(nèi)容及程序設(shè)計(jì)的基本方法與編程技巧。(2)較熟練地掌握在系統(tǒng)上編輯、編譯、連接和運(yùn)行c程序的方法。(3)通過(guò)設(shè)計(jì)一個(gè)完整程序,掌握數(shù)據(jù)結(jié)構(gòu)的算法編寫(xiě)、類c語(yǔ)言算法轉(zhuǎn)換成c程序并上機(jī)調(diào)試的基本方法。2、課程設(shè)計(jì)方案論證2.1 設(shè)計(jì)思路(1)定義結(jié)構(gòu)體 struct line,文本行采用順序存儲(chǔ),行與行之間采用鏈?zhǔn)酱鎯?chǔ)文章編輯系統(tǒng)統(tǒng)計(jì)字符刪除字符統(tǒng)計(jì)文字查找字符圖1:功能模塊圖(2)主要函數(shù):int countnumber(line * &head) /*統(tǒng)計(jì)數(shù)字?jǐn)?shù)*/ 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.2圖2:統(tǒng)計(jì)

2、數(shù)字函數(shù)流程圖:開(kāi)始*p=head,count=0int len=str len(p-data)i=0idatai=48 &p-datainext!p=null結(jié)束nynyn 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.3int findstring(line * &head,char *str) /*統(tǒng)計(jì)str在文章中出現(xiàn)的次數(shù)*/開(kāi)始count=0;h=0;len1=0; len2=strlen(str);p-datai=str0i+k=0;j=0;p-datai+j=strjk+;j+;k=len2count+;i=i+k-1;結(jié)束ynynny圖3:統(tǒng)計(jì)str在文章中的出現(xiàn)次數(shù) 沈 陽(yáng) 大 學(xué)課

3、程設(shè)計(jì)說(shuō)明書(shū) no.42.2 源程序清單#include #include typedef struct line char *data; struct line *next;line; void create(line * &head)line *p;printf (請(qǐng)輸入一頁(yè)文章,以#為結(jié)尾(每行最多輸入80字符!):n);p=(struct line*)malloc(sizeof(struct line); head=p; char tmp200; for(;1;) gets(tmp); if(strlen(tmp)80) printf(每行最多輸入80字符); break; if(tm

4、p0=35)break; p=p-next=(struct line*)malloc(sizeof(struct line); p-data=(char*)malloc(strlen(tmp); strcpy(p-data,tmp); if(tmpstrlen(tmp)-1=35) p-datastrlen(tmp)-1=0; 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.5 break; p-next=null; head=head-next;int countletter(line * &head) line *p=head; int count=0;do int len=strlen(p-data

5、); for(int i=0;idatai=a&p-dataidatai=a&p-datainext)!=null); return count; int countnumber(line * &head) line *p=head; int count=0; do int len=strlen(p-data); for(int i=0;idatai=48 & p-datainext)!=null); return count;int countspace(line * &head) line *p=head; int count=0; do int len=strlen(p-data); f

6、or(int i=0;idatai=32)count+; while(p=p-next)!=null); return count;/*統(tǒng)計(jì)文章的總字?jǐn)?shù)*/int countall(line * &head) line *p=head; int count=0; do count+=strlen(p-data); while(p=p-next)!=null); return count; 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.7int findstring(line * &head,char *str) line *p=head; int count=0; int h=0; int len1=0

7、; int len2=strlen(str); int i,j,k; do len1=strlen(p-data); for(i=0;idatai=str0)k=0; for(j=0;jdatai+j=strj) k+;if(k=len2)count+;i=i+k-1; while(p=p-next)!=null); return count;void delstringword(char *s,char *str) char *p=strstr(s,str); 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.8char tmp80; int len=strlen(s); int i=len-strlen

8、(p); int j=i+strlen(str); int count=0; for(int m=0;mi;m+)tmpcount+=sm; for(int n=j;ndata,str)!=null)delstringword(p-data,str);while(p=p-next)!=null); void output(line * &head) line *p=head; do printf(%sn,p-data); while(p=p-next)!=null); 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.9void main() int i=0; int operate;line * head

9、;create(head); printf(輸入的文章為:n); output(head); printf(n); printf(全部字母數(shù):%d n,countletter(head); printf(數(shù)字個(gè)數(shù):%d n,countnumber(head); printf(空格個(gè)數(shù): %d n,countspace(head); printf(文章總字?jǐn)?shù): %d n,countall(head); char str120,str220; printf(n); printf(*n); printf(* 菜 單 *n); printf(*n); printf(* 1-統(tǒng)計(jì)字符串 *n); pri

10、ntf(* 2-刪除字符串 *n); printf(* 0-退出 *n); printf(*n); do printf(請(qǐng)輸入你要選擇的操作: ); scanf(%d,&operate); switch(operate) 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.10case 1: printf(請(qǐng)輸入要統(tǒng)計(jì)的字符串:); scanf(%s,&str1);printf(%s出現(xiàn)的次數(shù)為:%d n,str1,findstring(head,str1); printf(n);countall(head); countnumber(head);countletter(head);countspace(he

11、ad); break; case 2: printf(請(qǐng)輸入要?jiǎng)h除的某一字符串:); scanf(%s,&str2); delstring(head,str2);printf(刪除%s后的文章為:n,str2);output(head); break; case 0: ;break; while(operate!=0); 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.113、課程設(shè)計(jì)運(yùn)行結(jié)果與分析圖3:初始界面 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.12圖4:運(yùn)行界面 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.13輸入1:統(tǒng)計(jì)字符數(shù)圖5:統(tǒng)計(jì)字符界面 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.14輸入2:刪除字符圖6:刪除字符 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.15輸入0:退出程序圖7:退出程序 沈 陽(yáng) 大 學(xué)課程設(shè)計(jì)說(shuō)明書(shū) no.164、課程設(shè)計(jì)體會(huì)此次課程設(shè)計(jì)使我對(duì)數(shù)據(jù)結(jié)構(gòu)方面的知識(shí)有了更加深入的了解,也使我認(rèn)識(shí)到自己在學(xué)習(xí)編程方面還有很多的不足。今后我要多讀一些編程方面的書(shū)籍,不能只拘泥于課本上的知識(shí),并注重理論與實(shí)踐的結(jié)合,多上機(jī)練習(xí)編寫(xiě)程序,提高自己的實(shí)際動(dòng)手能力和獨(dú)立思考的能力,不斷充實(shí)自己,更好的掌握編程思想。參考文獻(xiàn)1

溫馨提示

  • 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ì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論