View Single Post
Old 10-16-2005, 10:48 PM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,726
redhead is on a distinguished road
This isn't nearly enough... What is currentE declared as ? int, char, string, long, double, float, what ?? The comparison is against a char, if it was declared int, then the comparison should be against ints, the int value for the char '1' is 49 and for '4' it's 52.
If the input is treated as an int, then comparing it to the char will say
Code:
if( (value between 1 and 4) < 49 || (value between 1 and 4) > 52)
This, as you can see is giving false on every run, no matter if you type 1, 2, or 8
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote