--------- The example on C ++ primer is implemented by yourself.
The program can read any text file specified by the user and then allow the user to find words from the file. The query result shows the number of times a word appears and lists the rows that appear each time. If a word appears multiple times in the same row, the program displays this row only once. The row number is displayed in ascending order.
1) it must allow users to specify the name of the file to be processed. The program will store the content of the file so that the original line of each word can be output.
2) It must break each line into different words and record the row of each word. When outputting a row number, ensure that the output is in ascending order and there are no duplicates.
3) A Query of a specific word returns the row number of all rows of the word.
4) when outputting the text row of a word, the program must be able to obtain the corresponding row from the input file based on the given row number.
1) Use a vector <string> type object to store copies of the entire input file. Each row of the input file is an element of the vector object.
2) store the row numbers of each word in a set container object. Using set ensures that each row has only one entry, and the row numbers are automatically sorted in ascending order.
3) Use a map container to associate each word with a set container object, which records the row number of the word.