while ((answer != 'A') || (answer != 'B') || (answer != 'C') || (answer != 'D'))
This section of code accepts no answer, instead of just A B C or D.
Any thoughts on how I should do this?
Thanks/
Printable View
while ((answer != 'A') || (answer != 'B') || (answer != 'C') || (answer != 'D'))
This section of code accepts no answer, instead of just A B C or D.
Any thoughts on how I should do this?
Thanks/
Think about it a bit. Since you're using logical or ||, if any of those conditions is true, the expression is true.
Say answer is 'A'. If it's 'A', it's not 'B', so the expression is true. So instead of any of those conditions being true, you want all of them to be true. Think about what you may need to change to accomplish that.
Got it working, thanks!