N
nick048
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.
eg 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:
iNumber = 0; // Counter
while (1)
{ //read next
cout << "Enter number (Ctrl-z = Input End): ";
cin >> myNumber;
if (cin.eof())
break;
//update the counter
iNumber++;
}
But I am in difficulty, when I try to resolve the second step. The
solution don't have to use the array.
I hope in Your help in order to resolve my problem without array or map
or struct.
Thank You and Best Regards
Nino
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.
eg 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:
iNumber = 0; // Counter
while (1)
{ //read next
cout << "Enter number (Ctrl-z = Input End): ";
cin >> myNumber;
if (cin.eof())
break;
//update the counter
iNumber++;
}
But I am in difficulty, when I try to resolve the second step. The
solution don't have to use the array.
I hope in Your help in order to resolve my problem without array or map
or struct.
Thank You and Best Regards
Nino