That challenge was hard for me

That challenge was pretty hard for me but figured out a way to do it without help, albeit my solution was way more complicated then the answer given after the challenge, with much of it being unnecessary I’m sure. I also think I left the
“return false;” at the end to do nothing

I took the instructions literally and had it print either True or False.
At 1 AM the only thing my brain could think of to do is put the whole thing in an if statement.

I have the impression this is an amateur way of doing it. If I wanted it to print the actual words True or False this is the only way I could think of making it happen

I will revise to the answer given in the lecture of course as the only point of printing the true false is to make sure the function works properly.

Edit: Although I did get the use of the ‘OR’ syntax right on my own, so proud of myself for that.
Also, ALL feedback is wanted, i’m craving it right now, good and bad. Even if it’s to say “Yo man, hey guy wus up dewd, you suck at this mang, k bye”
In my opinion, if you have the right attitude all feedback can be encouragement, even if that encouragement is to prove the bad mouth guy wrong.
So if anyone sees me post anything and you’ve got something to point out then give it to me.

Seems pretty ok to me…

The code is OK.

Generally speaking , code that works is considered fine as long as it has some degree of readability.

If you want to make this better you can replace your use of strings with a boolean , this way you can compact two variables into one and all you have to do is convert the boolean to a string to pass it to the cout.

@Hellow5
Hey! Honestly if you are just using something once in your code such as a string which represents true or a string which represents false you may as well just manually type it as it would be too much work to initialize a string called true and a string called false and give them such values. You can argue both ways but generally unless you are using a value twice there is no reason to create a variable for it.

Also if you want to make the program more engaging you could check that if response[0] == y{
cout << “Let’s Play Again!” << endl;
}

else{
cout << “See you next time!” << endl;
}

Hi!

In your code you’re always returning false no matter what you type as an answer to the question.
You should be returning true for ‘y’ or ‘Y’ and false for ‘n’ or ‘N’.
Hope that helps!

Privacy & Terms