>>do i use the else if statement
No, just use another variable and statement like I did for the max value. I wouldn't use the
else statement because maybe the current value just read affects both min and max.
int max = 0;
int min = 0;
int i = 0;
while( inFile >> myArray[i])
{
if( i == 0) // first time throug
{
max = min = myArray[i];
}
if( myArray[i] > max)
max = myArray[i];
if( myArray[i] < min)
min = myArray[i];
++i;
}
And
you forgot to add code tags