Implement in C++ a function:
That given a file name it creates a map that contains the countfor each word.
map get_counts(string file_name) {}
Note the removal of the capitalization and punctuation.
and main method:
int main()
{
map r = get_counts(“LOTR.txt”);
cout << “the: ” << r[“the”] << endl;
cout << “lord: ” << r[“lord”] << endl;
cout << “of: ” << r[“of”] << endl;
cout << “rings: ” << r[“rings”] << endl;
cout << “fellowship: ” << r[“fellowship”] <<endl;
cin.get();
}
The output should be:
the: 54
lord: 1
of: 24
rings: 1
fellowship: 1
*Note that the way used to remove punctuation may affect thesenumbers by a small percentage.
Submit your .ccp file (not the .sln file)
content of file:
PayPal Gateway not configured
PayPal Gateway not configured