Write a complete C++ program that takes the judges’ scores for a gymnastic event and finds each contestant’s score. It should satisfy all the following specifications: it first reads in an integer N that gives the number of judges. It then reads in a contestant number followed by N integers which are the scores given the contestant by the N judges. The scores should be read into an array, and then the program calls a function called findAverageScore that takes N and the array of judges’ scores as arguments. The function should find and drop the highest score and the lowest score, and then find and return the average of the remaining N-2 scores. The main should then print the contestant number and the average score s/he receives for the event to the screen. It will continue to do this (read in the contestant number, then the N integers, then print the contestant number and the calculated score on a new line) until a negative value is entered for the contestant number. The program will then print the contestant number who scored the highest. (You may assume no ties will occur.) All input will be from the keyboard and you may also assume that N will never be greater than 10 and never less than 3.
Sample output screen for a session (Bold numbers are printed by the program; normal numbers are typed in by the user.)
Number of Judges: 5
34 7 5 3 7 6
Contestant 34 6
28 8 5 8 10 7
Contestant 28 7.666666667
3 5 5 3 4 4
Contestant 3 4.333333333
−1
Contestant 28 had the highest score.
<program ends>
Note: Could you plz go through this code and let me
know if u need any changes in this.Thank You
_________________
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
//Function Declaration
double calAverage(int nos[], int N);
int main()
{
//Declarin variables
int cnt = 0;
int N;
/* This loop continues to execute until
* the user enters a valid input
*/
while (true) {
cout << "Number of Judges:";
cin >> N;
if (N < 3 || N > 10) {
cout << "Invalid.Must be >=3 and <=10" <<
endl;
}
else
break;
}
// Creating array dynamically
int* contestants = new int[N];
double* avg = new double[20];
int* nos = new int[N];
int num;
for (int i = 0; i < N; i++) {
cin >> num;
if (num != -1) {
contestants[i] = num;
for (int j = 0; j < N; j++) {
cin >> nos[j];
}
avg[i] = calAverage(nos, N);
cout << "Contestant :" << contestants[i] << " "
<< avg[i] << endl;
cnt++;
}
else {
break;
}
}
double max = avg[0];
int maxIndx = 0;
for (int i = 0; i < cnt; i++) {
if (max < avg[i]) {
max = avg[i];
maxIndx = i;
}
}
//Displaying the output
cout << "Contestant " << contestants[maxIndx] <<
" had the highest score." << endl;
return 0;
}
double calAverage(int nos[], int N)
{
int min, max;
min = nos[0];
max = nos[0];
double sum = 0, avg = 0;
for (int i = 0; i < N; i++) {
if (min > nos[i])
min = nos[i];
if (max < nos[i])
max = nos[i];
}
int flag = 0, flag1 = 0;
for (int i = 0; i < N; i++) {
if (nos[i] == min && flag == 0) {
flag = 1;
continue;
}
if (nos[i] == max && flag1 == 0) {
flag1 = 1;
continue;
}
sum += nos[i];
}
avg = sum / (N - 2);
return avg;
}
____________________________
Output:

_______________Could you plz rate me well.Thank
You
Write a complete C++ program that takes the judges’ scores for a gymnastic event and finds...