I'm having an issue with boolean and logical operators. I'm trying to get wantsToppings
to evaluate to true
if toppings equals 'T'
or 't'
, but this code evaluates to true
, regardless of user input. I'm not sure what I am missing, but I know I gotta be missing something.
Thanks for any help.
cout << "Toppings wanted (T for toppings/N for no toppings)? ";
cin >> toppings;
if (toppings == 't' || 'T'){
wantsToppings = true;
} else {
wantsToppings = false;
}