I am receiving an error code saying that y, Y, n, and N are undefined. Although I know they are undefined I just want to use the user input for my if statements. I used the data type char for grad.
How do I make the if statement valid? I dont want the y's or n's to be variables but just user input.
1 2 3 4 5 6 7 8 9 10 11 12
cout << "Are you graduating this year? Y for yes or N for no";
cin >> grad;
if (grad != (y || Y))
{
gradfee = 00.00;
if (grad != (n || N))
cout << "Error! You must enter Y for yes or N for No.";
}
else
gradfee = 35.00;
Those booleans in those if statements don't actually evaluate to how you think they do. You have to type out everything, and by everything I mean if( grad != 'y' || grad != 'Y' )
Also I think you meant to put a single quote in there, due to them being characters, not variables.