I’ve looked and looked with the debugger and cannot seem to figure out why the IF statement always prints the message.
The IF statement checks to see if yesno != ‘Y’ ||(or) ‘N’
but regardless if i type y or Y or n N or H B it will show… . Im not sure what move to make anymore! I cant seem to find where its going wrong?
if(yesno != 'Y' || 'N') { ...
Thanks guys.
The
||doesn’t quite mean what you think it means. The correct approach is:This evaluates each side of the
&&independently, and the result is true if both sides are true.Note that
will always be true because any given character is either not Y or it is not N. This is probably not what you want.