Course Solutions Uncategorized (Solved) : Implement C Function Given File Name Creates Map Contains Count Word Map Getcounts String Q35651198 . . . .

(Solved) : Implement C Function Given File Name Creates Map Contains Count Word Map Getcounts String Q35651198 . . . .

 

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:

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post