Hi,
I am a new user of C++ and I am learning this language.
I want to resolve this example:
1) I have an indefinite sequence of integer (from 0 to 36) as Input;
2) I want to know the maximum number of occurrences and its value.
Sample
Input: 0, 2, 5, 2, 23, 11, 11, 23, 15, 17, 25, 11, 23, 18, 23 (Ctrl+z)
Output: Value is 23 Occurences is 4
For the input I have written this code:
But I am in difficulty, when I try to resolve the second step. TheCode:iNumber = 0; // Counter while (1) { //read next cout << "Enter number (Ctrl-z = Input End): "; cin >> myNumber; if (cin.eof()) break; //update the counter iNumber++; }
solution don't have to use the array/map/struct.
I hope in Your help in order to resolve my problem.
Thank You and Best Regards
Nino