Hi, i need some help in the following program:
I have to read from a .txt file, that contains integers and then cout the most occurred number with the number occurrence.
I know how to read from a file, however i need some hints concerning finding the most occurred number.
Thank you
Please note that this is not a homework site. We won't do your homework for you. The purpose of homework is that you learn by doing. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.
We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again.
There are many ways to implement the counting and the choice depends on how yo do read. Hence the need to see what you already have.
However, if all you need is a hint, then: std::map
How large are your integers ?
If the numbers are small, like 1 - 20 that should be easy to just declare all the numbers and add one each time it's found.