I am getting zero, the lowest test score is 10 not zero.
I created my own test file with only 10 scores to be able to test my program.
I am certain min should equal 10.
Here is how I read the data into the array after being sure the file opened correctly:
1 2 3 4
|
//Read numbers from file into the array.
int count;
for(count = 0; count < SIZE && inputFile >> score[count]; count++);
inputFile >> score[count];
|
Here is my function prototype
|
void minMax(double [], int); //Get Min & Max test scores
|
Here is the function call
Here is the function definition
1 2 3 4 5 6 7 8 9 10 11 12
|
void minMax(double score[], int SIZE)
{
int count;
int min = score[0];
for(count = 1; count < SIZE; count++);
{
if(score[count] < min)
min = score[count];
}
cout << "Min =" << min;
}
|
I haven't attempted to get the max yet.
We must write one function and return the min and max values of test scores.
A void function is required, and it must do both.
Any advice?
Kindest regards,
Joseph