their
Define a function named GetWordFrequency that takes a
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<string> wordsList, string currWord)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images