#include <iostream>
usingnamespace std;
int main ()
{
int number [5];
int max = 0;
for (int i = 0 ; i < 5 ; i++)
{
if (number [i] > max)
{
max = number [i];
}
}
return 0;
}
1. You do use the array uninitialized, so you are looking at undefined values. Perhaps you should get real numbers from somewhere before searching for max?
2. Pretending that you already ask numbers from user, I type negative numbers. 0 is no longer the correct answer.
3. How do you fix a code that does not produce any output? You add statements that do produce output.