#include <iostream>
#include <string>
#include <iomanip>
usingnamespace std;
int main ()
{
string diverName = " ", diverCity = " ";
int highestScore = 0, lowestScore = 20, score = 0, count = 0, judge = 1;
double degDif, overallScore = 0, averageScore = 0, overallAverage = 0, totalScore = 0;
char continueLoop = 'y';
cout << " Report to the media" << endl;
cout << "Event: diving competition" << endl;
do
{
cout << "Enter the divers name:";
getline(cin, diverName);
cout << "Enter the divers city:";
getline(cin, diverCity);
do
{
cout << "Enter score given by judge #" << judge << ":";
cin >> score;
judge++;
if (score < 0 || score > 10)
cout << "Invalid score - Please reenter (valid range: 0 - 10" << endl;
judge--;
cout << "Enter score given by judge #" << judge <<":";
cin >> score;
totalScore += score;
if (score > highestScore)
highestScore = score;
if (score < lowestScore)
lowestScore = score;
totalScore -= highestScore;
totalScore -= lowestScore;
averageScore = totalScore/3;
cout << setprecision (2) << fixed;
}
while (judge < 5);
cout << "what was the degree of difficulty?";
cin >> degDif;
while (degDif < 1.00 || degDif > 1.67)
{ cout << "Invalid degree of difficulty - Please reenter (valid range: 1 - 1.67)";
cin >> degDif;
overallScore = averageScore*degDif;
cout << "Diver: " << diverName << ". city: " << diverCity;
cout << "Overall Score was " << overallScore;
overallAverage += overallScore/count;
cin.ignore();
count++;
cout << "Do you want to process another diver (y/n)?";
cin >> continueLoop;
}
}
while (continueLoop == 'y' || continueLoop == 'Y');
cout << " Event Summary";
cout << "Number of divers participating: " << count;
cout << "Average score of all divers: " << overallAverage;
return 0;
}
Here is my issue, i cant figure out why when i compile this program it goes all crazy on me after i put in 3 or 4 numbers for judges scores. This program is makeing me crazy :(