Hi, I'm having trouble with the following code and any help is greatly appreciated.
/*##########################################################################
### The problem should prompt the operator to enter the
number of competitors, followed by the scores awarded to each
by the 5 judges. Scores can range from 0.0 to 6.0 in increments of 0.1.
Invalid scores entered by the operator should result in an error message
being displayed. To calculate the final score to be awarded to each
Diving Competitor, the highest and lowest scores are ignored and
the remaining scores are averaged to give the final score,
which is then displayed. The problem should continue
until specifically terminated.
##########################################################################*/
#include <iostream>
using namespace std;
int main (){ //start of main function
// variable declaration
int numberOfCompetitors; // number of competitors
float judgesScore; // scores awarded by each of the five judges
float finalScore; //final score awarded to competitor
int competitorCounter; // counts number of competitors
int judgeCounter; //counts number of judges
float lowestScore; // lowest score given to competitor
float highestScore; // highest score given to competitor
// initialisation phase
finalScore = 0; //initialise finalScore
competitorCounter = 1; //initialise loop counter
lowestScore = 6.0; // initialise lowest score to 6.0
highestScore = 0.0; // initialise highest score to 0.0
judgeCounter = 1; // initialise number of judges
//display welsome message
cout << "\n Welcome to the Diving Score program which \n determines the final score of each diver\n";
cout << " =========================================\n\n";
cout << "Please enter the number of competitors: "; // prompt user to enter number of competitors
cin >> numberOfCompetitors; // store number of competitors
// Processing phase
while (competitorCounter <= numberOfCompetitors) { //loop for each competitor
//prompt user to enter the scores for the 5 judges
while (judgeCounter <=5){ //loop 5 times
cout << "\nEnter the score for judge " << judgeCounter << ": "; //prompt user to enter judge's score
cin >> judgesScore; //store judges score
if (judgesScore >= 0.0 && judgesScore <= 6.0){
finalScore += judgesScore; //add judges score to final score
if (judgesScore < lowestScore){ //checks for lowest judge's score
lowestScore = judgesScore;}
if (judgesScore > highestScore){ //checks for highest judge's score
highestScore = judgesScore;}
judgeCounter += 1; //increment judgeCounter by 1
}
else {cout << "You have entered an incorrect value.\nPlease enter a value between 0.0 and 6.0...\n\n";
} //end if else
}//end while
cout << "highestScore = " << highestScore;
cout << "\nloweastScore = " << lowestScore <<endl;
finalScore = (finalScore - highestScore - lowestScore) / 3; //calculate final score for competitor
cout << endl << "finalScore for Competitor " << competitorCounter << " is: " << finalScore <<endl;
competitorCounter += 1; //increment competitor counter by 1
}//end while
system("pause");
return 0;
} // end of main function
thanks!