Having trouble with my boolean function. When I compile the program everything runs just fine, yet when I type in "no" it still says "what can I help you with?".
#include <iostream>
#include <string> //size()
#include <cctype> //isdigit()
using namespace std; //(xxx)xxx-xxxx
bool verification(string yesOrno)
{
if(yesOrno == "yes")return(true);
else return(false);
}
int main()
{
string yesOrno;
cout <<"Do you need more help\n";
cin >> yesOrno;
if(!verification(yesOrno))cout <<"What can I help you with?\n";
return(0);
}
!falseis?return (yesOrno == "yes");instead of adding in the extra step and complicating things unnecessarily.true