Define a function named GetWordFrequency that takes a vector of strings and a search word as parameters. Function GetWordFrequency() then returns the number of occurrences of the search word in the vector parameter (case insensitive). Then, write a main program that reads a list of words into a vector, calls function GetWordFrequency() repeatedly, and outputs the words in the vector with their frequencies. The input begins with an integer indicating the number of words that follow. Ex: If the input is: 5 hey Hi Mark hi mark the output is: hey 1 Hi 2 Mark 2 hi 2 mark 2 Hint: Use tolower() to set the first letter of each word to lowercase before comparing. The program must define and use the following function: int GetWordFrequency(vector wordsList, string currWord)
Define a function named GetWordFrequency that takes a
Then, write a main
Ex: If the input is:
5 hey Hi Mark hi markthe output is:
hey 1 Hi 2 Mark 2 hi 2 mark 2Hint: Use tolower() to set the first letter of each word to lowercase before comparing.
The program must define and use the following function:
int GetWordFrequency(vector<string> wordsList, string currWord)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images