数据结构上机实验报告8_第1页
数据结构上机实验报告8_第2页
数据结构上机实验报告8_第3页
数据结构上机实验报告8_第4页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

一实验目的 文学研究人员需要统计某篇英文小说中某些形容词的出现次数和位置,试写出一个实现这一 目标的文字统计系统,成为“文学研究助手” 。 二实验内容 英文小说存放在一个文本文件中;带统计的额词汇集合要以此输入完毕,即统计工作必须在 程序的以此运行后全部完成;程序的输出结果是每个词的出现次数和出现位置所在的行号。 三实验步骤(可选) 详细程序设计: #include #include using namespace std; #include /包含标准输入输出函数 struct word int line; int time; word * next; ; struct words char word_re20; int check; int time_t; words * next_s; word * next; ; words * input(words * head); /比较并存贮信息时候所用的函数 words * output(words * head); /单纯输出直观数据时所使用的函数 words * input(words * head) int count=0; int line=0; /记录行数所使用的变量 int time_words=0; head-next_s=new words; int check=1; words * insert=new words; word * insert_word=new word; insert=head-next_s; coutinsert-word_re; insert-time_t=0; insert-check=0; insert-next=new word; coutcheck; if(check=1) insert-next_s=new words; insert=insert-next_s; 2 insert-next_s=NULL; insert=head-next_s; while(insert!=NULL) coutword_renext_s; insert=NULL; int time=0; int time_gk=0,time_wt=0; char compare3=“ “; char getkey32; char * word_tair; FILE * getword; if(getword=fopen(“英文文件.txt“,“r“)=NULL) cout=a)|(word_tairtime_wt=A)|word_tairti me_wt=-) while(word_tairtime_wt=a)|(word_tairtime_wt=A)|wor d_tairtime_wt=-) getkeytime_gk=word_tairtime_wt; time_wt+; time_gk+; /读取出一个单词,并储存在新的变量中 getkeytime_gk+=0; insert=head-next_s; while(insert!=NULL) if(!strcmp(insert-word_re,getkey) count=insert-check; insert-check+; insert_word=insert-next; /判断是否是相同的单词 while(count0) insert_word=insert_word-next; count-; 广东工业大学实验报告 _自动化 _学院_网络工程_专业_3_班 学号_3111001381_姓名_何宇航 _ 成绩评定_ 教师签名 许亮 实验_八_题目_文学研究助手_ 课程名称 数据结构 A insert_word-line=line; insert_word-time=time_words; insert_word-next=NULL; insert_word-next=new word; break; /储存相应的信息 insert=insert-next_s; time_words+; if(word_tairtime_wt+=n) break; coutnext_s; words * insert=first; word * insert_word=new word; while(insert!=NULL) coutword_rechecknext; while(insert-checktime) time+; coutlinetime+1next; insert=insert-next_s; time=0; return head; int main() words * head_emp=new words; strcpy(head_emp-word_re,“this is empty“); /母鏈的頭賦空 head_emp-check=-1; head_emp-time_t=0; head_emp-next=NULL; input(head_emp)

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论