I'm having trouble getting my program to display the proper minimum number. It is outputting (-858993460) It is outputting the highest number and average number properly, just not the lowest. I've tried everything I've found on here but I'm missing something. Any help would be appreciated.
constint SIZE = 20;
int grades[SIZE];
int count = 0, total = 0;
cout << "Enter up to 20 grades, then enter -1 when finished." << endl;
cout << endl;
while (count < SIZE)
{
cout << "Enter value #" << count + 1 << ": ";
cin >> grades[count];
if (grades[count] != -1)
{
total += grades[count];
count++;
}
elsebreak;
}
int max = grades[0];
int min = grades[0];
for (int i = 0; i < SIZE; ++i)
{
if (max < grades[i])
{
max = grades[i];
}
elseif (min > grades[i])
{
min = grades[i];
}
}
int average = total / count;
cout << endl;
cout << "The highest grade is: " << max << endl;
cout << "The lowest grade is: " << min << endl;
cout << "The average grade is: " << average << endl;