it compiles and runs, it gives me the average and the highest score but says lowest is 0 even though 0 is never entered.
//Write a program which uses an array of 5 scores and calculates the average score, the highest score and the
//lowest score.
#include <iostream>
using namespace std;
int getHighest(int [], int);
int getSmallest(int [], int);
double getAverage(int [], int);
int count;
int numbers;
int main()
{
const int SIZE = 5;
int scores[SIZE];
double average;
int biggest, smallest;
for(int i=0; i<SIZE; i++)
{
cout << "Enter score for student: " << i+1 << ": " ;
cin >> scores[i];
while(scores[i] > 100 || scores[i] < 0)
{
cout << "Invalid score. Enter value between 0 and 100" << endl;
cin >> scores[i];
}
In getHighest and getSmallest, biggest and smallest are random values. You don't initialize them to anything, it is only by chance that one works at all.
1 2 3 4 5 6 7 8 9 10 11
int getHighest( int total[], int s)
{
int biggest = total[0] ;
for(int i = 1; i < s; i++)
if (total[i] >biggest)
biggest = total[i];
return biggest;
}