The exercise is finding the largest and second largest numbers of ten entered. The numbers can only be entered once. No functions, arrays, of the STL can be used... Just while statements
The problem I'm having is with a sequence 5, 4, 9... The 5 becomes the largest, 4 is second largest, and when the 9 becomes largest, 4 is still the second largest (the 5 drops out).
Is there any way to do this short of :
while(count < 10){
cout << "Enter a number: ";
cin >> number;
number10 = number9;
number9 = number8;
number8 = number7;
number7 = number6;
number6 = number5;
number5 = number4;
number4 = number3;
number3 = number2;
number2 = number1;
number1 = number;
count++;
}
and then comparing all of this against one another. There has to be a better way.
TIA
LubLub