#include<iostream>
usingnamespace std;
int main()
{
// array variable declaration and initialization:
constint SIZE = 10;
int numbers[SIZE] = {};
int highest;
highest = numbers[0];
for (int i = 0; i < SIZE ; i++)
{
cout<<"current number is: "<<numbers[i]<<"\t"
<<"current highest number is: "<<highest<<endl;
if (numbers[i] > highest)
highest = numbers[i];
}
cout<<"The highest number in the array is: "<<highest<<endl;
return 0;
}
'std::cin' is the stream that receives user input.
One possibility, add the following somewhere before line 11;
1 2 3 4 5
cout << "Enter " << SIZE << " numbers: ";
for (int i = 0; i < SIZE; i++)
{
cin >> numbers[i];
}
The alternative is to ask for input interlaced between calculating the maximum so far, in which case you'd want to put the cin >> statement within your for loop (lines 13 - 20), and have another cin statement before line 12 (to enter numbers[0]).