# Solved: A program that calculates the average of a group of test scores…

\$30.00

Category:

## Description

Solved: A program that calculates the average of a group of test scores…

Write a program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions.

Void getscore() should ask the user for a test scores, store it in a reference parameter variable and validate it. This function should be called by main once for each of the five scores to be entered.

Void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main, and should be passed the five scores.

Int findLowest() should find the lowest of the five test scores passed to it. It should be called be calcAverage, which uses the function to determine one of the five scores to drop.

Do not accept scores less than 0 or higher than 100.

Below is what I have:

#include

using namespace std;

const int n=5;

int score;

void getscore()

{

cout << “Enter scores:\n”;

for (int i = 0; i < n; i++)

{

cin >> score[i];

while(score[i]<0 || score[i]>100)

{

cout<<“\n***incorrect entry\n\n”;

cin>>score[i];

}

}

}

int findLowest()

{

int small = 101;

for (int i = 0; i < n; i++)

{

small = score[i] < small ? score[i] : small;

}

return small;

}

void calcAverage ()

{

int lowest=findLowest();

double average = 0;

for (int i = 0; i < n; i++) {

average += score[i];

}

average -= lowest;

average /= 4;

cout << “\nAverage of the four highest scores are: ” << average << endl;

}

int main()

{

getscore ();

calcAverage ();

return 0;

}

error: Content is protected !!