+ 1
My code always outputs to true
So I am experimenting with objects and classes by making a program that makes a "person", but I stopped to test and make sure my if/else was working and noticed it always outputted to true. Am I doing something wrong or does solo learn just not like if/else statements (I have just started using this and it is a browser compiler so I"m not sure) https://code.sololearn.com/csv7EJxUe83Q/#cpp EDIT: thanks to visph for the answer! (I don't know how to reply to comments :/)
2 Respuestas
+ 3
At least, you have one mistake at line:
if(input == "yes" || "y"){
Doing as is, result as always true, because "y" is always true ^^
You do correct by this way:
if((input == "yes") || (input=="y")){
+ 1
@rocflcow2:
I see your edit XD
I guess you'll quickly find... it's no more hard than posting a question ;)
... or upvote :P