0

Lab assignment

How can I write a function accepting a string object as its argument? Function should return a character that appears most frequently in the string. The function should also use a reference variable to return the number of times the most frequent character appeared in the string object.

28th Apr 2018, 8:12 PM
Kenneth
1 Answer
+ 1
char func(string str, int& outFreq) for counting characters: I find "map" the most useful thing for tracking multiple object, tho you must hold what objects are there, in a different array for example. at the end You just take a look at how many times they appear and return it
28th Apr 2018, 10:14 PM
Paul