• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Boolean function in C++...

idNut

Diamond Member
Okay, I need to do this last thing for my project but I don't fully understand what it wants me to do. 😕 It says:

The program will continue until the user enters N or n. This means that anything other than Y,y,N,n will be invalid and you will notify the user and keep asking until they get it right. You will create a YesNoResponse object to acheive this. This object will have a function that gets the response and validates it and returns a bool. (Hint: create a variable of a YesNoResponse type before the while loop in main(). Then call the function inside the YesNoResponse object to return true to continue, false to stop.)

I'm not totally clear on what the f*** he means but I already have a data validation for my program but he wants one with a bool? Someone explain this to me if you could.
 
something like this

ask reader for input and insert into a char variable

bool function(char variable){
if(variable="Y" || variable="y" || variable="N" || variable="n")
{
return true;
}
return false;
}

you will need a while loop in your main that runs while the return is false. this should work. syntax is a little sketchy, i need to refresh on my c. should work though (if i'm interpreting your professors wording correctly, i think he needs to learn how to state things a little clearer.)
 
Back
Top