C语言版数据结构课程设计文章编辑系统

上传人:枫** 文档编号:553515267 上传时间:2023-06-05 格式:DOC 页数:16 大小:205.50KB
返回 下载 相关 举报
C语言版数据结构课程设计文章编辑系统_第1页
第1页 / 共16页
C语言版数据结构课程设计文章编辑系统_第2页
第2页 / 共16页
C语言版数据结构课程设计文章编辑系统_第3页
第3页 / 共16页
C语言版数据结构课程设计文章编辑系统_第4页
第4页 / 共16页
C语言版数据结构课程设计文章编辑系统_第5页
第5页 / 共16页
点击查看更多>>
资源描述

《C语言版数据结构课程设计文章编辑系统》由会员分享,可在线阅读,更多相关《C语言版数据结构课程设计文章编辑系统(16页珍藏版)》请在金锄头文库上搜索。

1、课程设计说明书 NO.1文章编辑系统1、课程设计目的(1)较熟练地掌握语言的基本内容及程序设计的基本方法与编程技巧。(2)较熟练地掌握在系统上编辑、编译、连接和运行C程序的方法。(3)通过设计一个完整程序,掌握数据结构的算法编写、类C语言算法转换成C程序并上机调试的基本方法。2、课程设计方案论证2.1 设计思路(1)定义结构体 struct line,文本行采用顺序存储,行与行之间采用链式存储文章编辑系统统计字符删除字符统计文字查找字符图1:功能模块图(2)主要函数:int CountNumber(LINE * &head) /*统计数字数*/ 沈 阳 大 学课程设计说明书 NO.2图2:统计

2、数字函数流程图:开始*p=head,count=0int len=str len(p-data)i=0idatai=48 &p-datainext!p=NULL结束NYNYN 沈 阳 大 学课程设计说明书 NO.3int FindString(LINE * &head,char *str) /*统计str在文章中出现的次数*/开始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;结束YNYNNY图3:统计str在文章中的出现次数 沈 阳 大 学课

3、程设计说明书 NO.42.2 源程序清单#include #include typedef struct line char *data; struct line *next;LINE; void Create(LINE * &head)LINE *p;printf (请输入一页文章,以#为结尾(每行最多输入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; 沈 阳 大 学课程设计说明书 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;/*统计文章的总字数*/int CountAll(LINE * &head) LINE *p=head; int count=0; do count+=strlen(p-data); while(p=p-next)!=NULL); return count; 沈 阳 大 学课程设计说明书 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); 沈 阳 大 学课程设计说明书 NO.8char tmp80; int len=strlen(s); int i=len-strlen(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); 沈

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 大杂烩/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号