大文件里查找单词的问题
35
RT
•Definea function that, given an istream& and a constvector<string>&, produces a map<string,vector<int>> holding each string (keyword) and the numbers of the line on which thestring appears. The line number of the first line is 1. •Printin the order of ascending keyword.•Runthe program on a text file with at least 10000 lines looking for no fewer than10 keywords.
窝只是想问问怎么在一个vector里查找另一个……!求教!!
问题补充:
keywords.txt用来存放需要寻找的关键词text是一个大文本result 是存放结果的txt然后要做的就是寻找keywords.txt里的关键词在text.txt里出现的行数我的程序已经能实现的部分是把keywords.txt里的单词分割,把text.txt一行一行分割就是不清楚怎么查找……还有存入map也辛苦大家讲一下辣!
35
RT
•Definea function that, given an istream& and a constvector<string>&, produces a map<string,vector<int>> holding each string (keyword) and the numbers of the line on which thestring appears. The line number of the first line is 1. •Printin the order of ascending keyword.•Runthe program on a text file with at least 10000 lines looking for no fewer than10 keywords.
窝只是想问问怎么在一个vector里查找另一个……!求教!!
问题补充:
keywords.txt用来存放需要寻找的关键词text是一个大文本result 是存放结果的txt然后要做的就是寻找keywords.txt里的关键词在text.txt里出现的行数我的程序已经能实现的部分是把keywords.txt里的单词分割,把text.txt一行一行分割就是不清楚怎么查找……还有存入map也辛苦大家讲一下辣!