im having a problem here and it seems I just cannot get my logic right.
this is in a class
and this is what is in my driver
no matter what it will not get past the first if statement and returns my "invalid input" error. What did I do wrong thanks for any help
Joined: May 12, 2008
um. Don't hit yourself too hard but lets pretend that you input 'O' ... the first OR in your if statement will evaluate to true and kick you down. I think you mean to have used
( ch != 'X' && ch != 'x' && ch != 'O' && ch != 'o')... if it isn't ANY of those...go in there. Not if it isn't just one of those cases.
Joined: Apr 02, 2009
Thank you very much. I knew it was something too simple, can't believe I missed that; Moral of the story.... caffeine != a substitute for sleep.
Joined: Oct 13, 2005
Welcome to JavaRanch
Putting !() round your test would sort it out. You can use different formulae; look up de Morgan's Law for how to convert between || and && when there are nots around.