I don't quite understand what you are trying to accomplish here, but I have noticed a few problems with your code.
First, I don't think you can use the OR (||) operator when declaring variables, you can only use it when comparing values (for example in an if statement).
Second, with your new int and float anyTestScore, there are no semicolons (;) at the end of the statement, which will also result in an error.
Third, you should either get rid of one of the anyTestScore variables or change the name of one of them because they both have the same identifier name, and that should result in an error.
To shorten the length of your working code, you can do this:
1 2 3 4 5 6 7
|
if ( (testScore1 < 0 || testScore1 > 100) || (testScore2 < 0 || testScore2 > 100) || (testScore3 < 0 || testScore3 > 100) )
{
cout << "Input out of range: Program terminating" << endl;
cout << endl << "Press ENTER to finish...";
cin.ignore(99,'\n');
return 1;
}
|
This configuration will work in this case, but if you plan each variable to do anything different, then you may have to revert it. Hope this helped!