Hi all,
I am a beginner to C++ and am having problems with data validation in a project. The program is a oylmpic diving score program and is working ok only for when I input an invalid character the for loop seems to continusal run. Is there an easy for me to fix this so that I can just output to the user "Invalid character"??
Please see below section of code...
//User input
cout<<"\nPlease enter first judges score : \n\n";
cin>>judge1;
//While loop for data validation
while (judge1<0 || judge1>6)
{
cout<<"Invalid score, must be in the range 0.0 to 6.0\n\n";
cout<<"Please reenter\n";
cin>>judge1;
}