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

(Solved) : Memory Operand Cont C Code G H 8 Compiled Mips Code Lw T0 32 Ss3 Load Word Add Ss1 Ss2 St0 Q34204032 . . . .(Solved) : Memory Operand Cont C Code G H 8 Compiled Mips Code Lw T0 32 Ss3 Load Word Add Ss1 Ss2 St0 Q34204032 . . . .

<br/><img src="https://media.cheggcdn.com/media%2Fa7a%2Fa7a436f7-b61d-40b3-ac91-26c3877e42aa%2Fimage.png" alt="Memory Operand (Cont.) C++ code: g h+A[8]; Compiled MIPS code: lw $t0. 32(Ss3) # load word add Ss1, Ss2, St0 offse base register The first instruction loads the