- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
【问题描述】
文学研究人员要统计某篇英文小说中某些形容词的出现次数和位置 .试写一个实现这一目标的文学统计表 ,称为 文学研究助手
【基本要求】
a。英文小说存在于一个文本文件中 .待统计的词汇集合要一次输入完毕 ,即统计工作必须在程序的一次运行之后完成 .程序的输出结果是每个词的出现次数和出现位置所在行的行号格式自行设计
,
b。模式匹配要基于 KMP 算法
c。整个统计过程中只对小说文字扫描一次 ,以提高效率
【测试数据】
以当前的源程序文件作为测试目标
【实现提示】
约定小说中的词汇一律不跨行
【思路演示】
【代码过程】
1。
Try to
write a text to achieve this objective statistical system, known as the literary research assistants. English novel
stored in a text file. Statistical terms to be set to enter the end, that is, the statistical work program must be run
after a fully completed. Process the output result is the emergence of each word occurrence frequency and the
line number where the line, the format design.
#include iostream
#include string
using namespace std;
#include
struct word
{
int line;
int time;
word * next;
};
struct words
{
char word_re[20];
int check;
int time_t ;
words * next_s;
word * next;
};
19.
words * input(words * head);
// 比較並儲存信息時候所用的函數
20.
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;
cout 请输入需要查询的单词 endl;
while (check)
{
cininsert-word_re;
insert-time_t =0;
insert-check=0;
insert-next=new word;
38. cout 还希望搜索其他的单词么 ,1 继续, 0 停止 endl;
cincheck;
if(check=1)
{
insert-next_s=new words;
insert=insert-next_s;
}
}
insert-next_s=NULL;
insert=head-next_s;
while (insert!=NULL)
{
coutinsert-word_reendl;
insert=insert-next_s;
}
insert=NULL;
int time=0;
int time_gk=0,time_wt=0;
char compare[3]= @ ;
char getkey[32];
char * word_tair;
FILE * getword;
if((getword=fopen( ,r ))==NULL)
{
couterror ;
return 0;
}
char word_c[80];
66. while (fgets(word_c,80,getword)!=NULL) // 讀取一行中的 80 個字符
{
line++;
time_words=0; // 尋找的字符出現的次數
time_gk=0; // 儲存用來比較的字符串所使用的變量
time_wt=0; // 在儲存行字符串的變量中定位
word_tair=NULL;
word_tair=word_c;
time=strlen(word_tair);
couttime;
coutword_tairendl;
while (word_tair[time_wt]!= \n
您可能关注的文档
- 房产证办理授权委托书(2018年模板).docx
- 房屋出租委托书34770.docx
- 房屋安全鉴定基础知识.docx
- 房屋建筑安全.docx
- 房屋建筑安全协议.docx
- 房屋技术报告(市场法及收益法)作业.docx
- 房屋拆除安全责任书39269.docx
- 打开财富密钥(有志男儿必读).docx
- 执业中医师中药版真的能过.docx
- 执业医师考试真题版真的能过.docx
- 文献综述:信息技术与高中语文课程整合.docx
- 新SAT考试详细流程介绍.docx
- 新三板挂牌公司投资型行业分类指引.docx
- 新人教(pep)五年级英语下册Unit1Myday(PartALetx27slearn)说课稿.doc.docx
- 新人教(pep)五年级英语下册Unit2MyFavoriteSeason说课稿.doc.docx
- 新人教(pep)五年级英语下册Unit4过关检测卷.doc.docx
- 新人教(pep)五年级英语下册Unit6Workquietly!PartALet’stalk说课稿.doc.docx
- 新人教(pep)五年级英语下册期末调研试卷(含答案).doc.docx
- 新人教(pep)四年级英语下册Aletx27stalk说课稿.doc.docx
- 新人教(pep)四年级英语下册myfriend中第let’slearn说课稿.doc.docx
文档评论(0)