if statement not working right?

前端 未结 5 1652
执念已碎
执念已碎 2020-12-02 03:19

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 != \'

5条回答
  •  眼角桃花
    2020-12-02 03:58

    if(yesno != 'Y' || 'N')
    

    should be:

    if(yesno != 'Y' && yesno != 'N')
    

    You are chaining them which is incorrect. I am fairly sure you know that you should not and that is a typo, because you used && correctly on line no 44.

提交回复
热议问题