first attempt at array, need help
I am trying to do a problem out of my book that accepts 10 numbers and prints the biggest number using an array. It will always print 0 because thats what my newmax is initialized to. Any help appreciated.
Code:
#include <iostream>
#include <string>
using namespace std;
int main ()
{
const int NUMEL = 10;
int fmax[NUMEL];
int i;
int max, newmax = 0;
cout << "Enter a number " << endl;
cin >> max;
for ( i = 0; i <= 9; i++)
{
cout << "Enter a number " << endl;
cin >> fmax[i];
}
if (fmax[i] > max){
newmax = fmax[i];
}
cout << "the biggest number is " << newmax << endl;
system ("pause");
return 0;
}