c语言版数据结构课程设计-文章编辑系统.docx

c语言版数据结构课程设计-文章编辑系统.docx

  1. 1、本文档共14页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
文章编辑系统 1、 课程设计目的 较熟练地掌握C语言的基本内容及程序设汁的基本方法与编程技巧。 较熟练地掌握在系统上编辑、编译、连接和运行C程序的方法。 通过设计一个完整程序,掌握数据结构的算法编写、类C语言算法转换成C程序 并上机调试的基本方法。 2、 课程设计方案论证 2.1设计思路 定义结构体struct line,文本行采用顺序存储,行与行之间采用链式存储 统计文字 文章编辑系统统计字符 文章编辑系统 查找字符 删除字符 图1:功能模块图 (2)主要函数: int CountNumber (LINE * fthead) /*统计数字数*/ 图2:统计数字函数流程图 2.2源程序清单 — Sinclude string?h ^include stdio. h typedef struct line { char *data; struct line *next; }LINE; void Create(LINE * head) { LINE *p; printf (请输入一页文章,以#为结尾(每行最多输入80字符!):\『); p=(struct line*)malloc(sizeof(struct line)); head二p; char tmp.200]; for(;l;) { gets(tmp); if (strlen(tmp)80) { printf r每行最多输入80字符); break; } if(tmp[0]==35)break; p=p-next= (struct line*)malloc(sizeof(struct line)); p-data=(char*)malloc(strlen(tmp)); strcpy (p-data, tmp); if (tmp [strlen (tmp) T] =35) { p-dataEstrlen(tmp)-1」=\0‘ ; break; } } p-next=NULL; head=head-next; } int CountLetter(LINE * head) { LINE *p=head; int count^O; do { int Len=strlen(p-data); for(int i=0;iLen;i++) if((p-data[i]=,a p-data[i]=,z) (p-data[i]=,A p-data[i]=,Z)) count++; } while ((p=p-next)!=MULL); return count; } int CountNumber(LINE * head) { LINE *p=head; int count二0; do { int Len=strlen(p-data); for(int i=0;iLen;i++) if(p-datali]=48 p-data[i]=57)count++; while((p=p-next)!=NULL); return count; } int CountSpace(LINE * head) { LINE *p二head; int count=0; do { int Len=strlen(p-data); for(int i=0;iLen;i++) if (p-datali] =32) count++; } wh订e((p=p-next)!=NULL); return count; } /*统计文章的总字数*/ int CountAll(LINE * head) { LINE *p=head; int count^O; do { count+=strlen(p-data); } while ((p=p-next)!=NULL); return count; } int FindString (LINE * head, char * str) { LINE *p二head; int count二0; int h二0; int lenl=0; int len2=strlen(str); int i, j, k; do { lenl=strlen(p-data); for(i=0;ilenl;i++) { if(p-data[i]==str[0]) { k=0; for(j=0;jlen2;j++) if(p-data[i+j]==str[j]) k++; if(k==len2) {count++;i=i+k-l:} } } } while ((p=p-next)!=NULL); return count; } void delstringword(char *s,char *str) { char *p=strstr(s,str); char tmp[80]; int len=strlen(s

您可能关注的文档

文档评论(0)

xiaozu + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档