Hello everybody. I have a simple question on how to properly use the bool. The last time I used the bool in a homework assignment I did used it wrong, but it worked. This is what I did.
bool lineOne; string yesNo;
cin >> yesNo;
lineOne = (yesNo == "YES");
My facilator said, "A boolean variable was declared and an attempt to set its value is in the code, but the code does not set the boolean value for the variable correctly".
Looks fine to me. The expression used to assign lineOne a value yields a Boolean value (it's a Boolean context). Though, "but the code does not set the boolean value for the variable correctly" leads me to believe that your tutor wanted you to get the value in some other way (possibly by initialising lineOne and not assigning it a value?).