| Author |
Simple logic is kicking my butt.
|
Robert Brown
Greenhorn
Joined: Apr 02, 2009
Posts: 4
|
|
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
|
 |
Paul Yule
Ranch Hand
Joined: May 12, 2008
Posts: 229
|
|
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.
|
 |
Robert Brown
Greenhorn
Joined: Apr 02, 2009
Posts: 4
|
|
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.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32611
|
|
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.
|
 |
 |
|
|
subject: Simple logic is kicking my butt.
|
|
|