--- In [email protected], Tyler Littlefield <ty...@...> wrote:
>
> My only thing is you should only be getting 4, not 5. make for (i=0;i<5;i++)

To clarify, the loop does 5 iterations, which is what the question asks for, 
but the numbers are being stored in x[1..5]. In C++, array indices start at 0, 
and the numbers should be stored in x[0..4]; x[5] is invalid (storing a value 
in it might cause the programme to crash). Tyler's suggestion solves the 
problem.

It could be improved by including the number count in the prompt eg.

    cout << "enter number " << i + 1 << endl;

Note that the array index 0..4 is converted into 1..5 for display to the user, 
because humans tend to start at 1 rather than 0.

The code to find the largest and smallest numbers is wrong. Try to write down 
what you need to do using words instead of code, then convert the words into 
code. Post back if you get stuck.

Reply via email to