#include <iostream>
usingnamespace std;
void getValues(int[],int);
void calcAvg(int[],int);
int findLow(int[],int);
int main()
{
int x;
cout<<"Input the numer of test scores: ";
cin>>x;
getValues(int scores[],x);//Expected primary-expression before 'int'
}
void getValues(int scores[],int x)
{
int y = 0;
int i = 0;
while (i < x)
{
cout<<"Input a test score: ";
cin>>y;
if (y < 0 || y > 100)
cout<<"Invalid Test Score\n";
else
{
scores[i] = y;
i++;
}
}
calcAvg(scores[],x);//Expected primary-expression before ']' token
return;
}
void calcAvg(int scores[],int x)
{
int avg, low, sum;
int i = 0;
low = findLow(scores[],x);//Expected primary-expression before ']' token
while (i < x)
{
sum += scores[i];
i++;
}
avg = (sum - low) / (x - 1);
cout<<"The lowest test score is "<<low<<". The test average with the lowest score dropped is "<<avg<<".\n";
return;
}
int findLow(int scores[],int x)
{
int low = 100;
int i = 0;
while (i < x)
{
if (scores[i] < low)
low = scores[i];
i++;
}
return low;
}