While infinite loop with cin

In the function Decide under my switch-case there is code that will get scores from the user and if the score does not fall in between 0-10 it is supposed to say:
Error!
Score "counter + 1" (0-10):
and the user would re input the score but the while loop is making the cout's go into an infinite loop. Any help?

#include <iostream>
#include <string>
using namespace std;

//Get the name of the Diver
string GetDiverName(){
string DiverName;
cout << "Enter the diver's name: \n";
getline(cin, DiverName);

return DiverName;
}

// Get number of dives
int GetDiveNumber(){
int DiveNumber;
cout << "How many dives will be judged for this diver? (1-5): \n";
cin >> DiveNumber;
while (DiveNumber > 5 || DiveNumber < 1){
cout << "Error!\n";
cout << "How many dives will be judged for this diver? (1-5): \n";
cin >> DiveNumber;
}
return DiveNumber;
}

void Decide(int DiveNumber, string DiverName){
int count = 0;
char Dive;
int NumberOfScores;
float Score[10];
string TheDive;
int counter;
float total = 0;
float Difficulty;
float average;
int ScoreAdder;

for (count = 0; count < DiveNumber; count++){
cout << " Menu\n";
cout << "---------------------------------------------------\n";
cout << "Dive Difficulty\n\n";
cout << "A. Forward Jump Pike 1.0\n";
cout << "B. Forward Dive Straight 1.6\n";
cout << "C. Forward 2.5 Tuck 2.2\n";
cout << "D. Back 3.5 Tuck 3.4\n";
cout << "E. Inward 0.5 Twist Straight 1.9\n";
cout << "Dive " << count + 1 << " of " << DiveNumber << " to be judged (A-E)(UPPERCASE ONLY):";
cin >> Dive;
while (Dive > 'E'){
cout << "Error!\n";
cout << "Dive 1 of " << DiveNumber << " to be judged (A-E)(UPPERCASE ONLY):";
cin >> Dive;
}
switch (Dive){ //Storing Dive and Difficulty
case 'A':
TheDive = "Forward Jump Pike";
Difficulty = 1.0;
break;
case 'B':
TheDive = "Froward Dive Straight";
Difficulty = 1.6;
break;
case 'C':
TheDive = "Forward 2.5 Tuck";
Difficulty = 2.2;
break;
case 'D':
TheDive = "Back 3.5 Tuck";
Difficulty = 3.4;
break;
case 'E':
TheDive = "Inward 0.5 Twist Straight";
Difficulty = 1.9;
break;
default:
break;
}
cout << "How many scores will be entered? (3-6):"; //Getting Scores
cin >> NumberOfScores;
while (NumberOfScores < 3 || NumberOfScores >6){
cout << "Error!\n";
cout << "How many scores will be entered? (3-6):";
cin >> NumberOfScores;
}
for (counter = 0; counter < NumberOfScores; counter++){
cout << "Score " << counter + 1 << " (0-10):";
cin >> Score[counter];
while (Score[counter] < 0 || Score[counter]>10){
cout << "Error!\n";
cout << "Score " << counter + 1 << " (0-10): ";
cin.ignore();
cin >> Score[counter];
}
}
total = 0;
for (ScoreAdder = 0; ScoreAdder < NumberOfScores; ScoreAdder++){ //Getting average and total with difficulty
total = total + Score[ScoreAdder];
}
average = total / NumberOfScores;
total = total * Difficulty;
cout << " Diving Score\n";
cout << "-------------------------------------------------------\n";
cout << "Dive Difficulty Total Average\n";
cout << TheDive << " " << Difficulty << " " << total << " " << average << endl;
switch (NumberOfScores){
case 3:
if (total >= 28.5){
cout << DiverName << " received a total of " << total << " and has qualified for finals! (Needed 28.5)\n";
}else{
cout << DiverName << " received a total of " << total << " and has NOT qualified for finals! (Needed 28.5)\n";
}
break;
case 4:
if (total >= 39.0){
cout << DiverName << " received a total of " << total << " and has qualified for finals! (Needed 39.0)\n";
}
else{
cout << DiverName << " received a total of " << total << " and has NOT qualified for finals! (Needed 39.0)\n";
}
break;
case 5:
if (total >= 48.0){
cout << DiverName << " received a total of " << total << " and has qualified for finals! (Needed 48.0)\n";
}
else{
cout << DiverName << " received a total of " << total << " and has NOT qualified for finals! (Needed 48.0)\n";
}
break;
case 6:
if (total >= 57.0){
cout << DiverName << " received a total of " << total << " and has qualified for finals! (Needed 57.0)\n";
}
else{
cout << DiverName << " received a total of " << total << " and has NOT qualified for finals! (Needed 57.0)\n";
}
break;
default:
break;
}
}
}

char ReRun(){
char Redo;
cout << "Do you want to run the program again? (Y/N) (UPPERCASE SENSITIVE):";
cin.ignore();
cin.get(Redo);
cin.ignore();
return Redo;
}
int main(){
//Initialize Variables
int DiveNumber;
string DiverName;
float Score[10];
double total;
char Redo;

do{
//Bring Diver name into main
DiverName = GetDiverName();

//Bring number of dives into main
DiveNumber = GetDiveNumber();

//Get Dives to be judged and results displayed and final qualification displayed
Decide(DiveNumber, DiverName);

Redo = ReRun();
} while (Redo == 'Y');


system("pause");
return 0;

}
I don't understand the problem? It does say error when you input the score 11.
Topic archived. No new replies allowed.