第五次作业
作业要求:
- 读取小文本文件A_Tale_of_Two_Cities.txt 或者 大文本文件Gone_with_the_wind.txt,统计某一指定单词在该文本文件中出现的频率。
git:https://github.com/775320358/list/blob/master/5.cpp
查找指定单词频率:
for (int j = 0; j < wCount - 1; j++) //统计单个单词的个数 { if (words[j].Str == searchword) { cout << searchword << ":" << words[j].Count<<endl; searchword = "true"; //未找到做记号 } } if (searchword != "true") { cout << "not find word"; }
总结:在上次编程的基础上增加查找词频即可。但仍不知如何实现那个要求。