|
-
Jan 6th, 2006, 04:04 AM
#3
Thread Starter
New Member
Re: If else- letters not allowed
 Originally Posted by CornedBee
Well? What's the expected result, the actual result? Any compile errors (for example from that extra logical OR in the if)?
As it is now, the else will be only executed if the number is between 1 and 50 inclusive. Isn't that what you want?
Yes, i rectify what i have written. There should not be any extra ||. I forgot to erase it. What i was doing was the following:
if(value < 1 || value > 50|| (char) value)
So,when i type letters, the characters should not be accepted. Unfortunately, this does not work.
There is no compile errors if the extra|| is taken out.
But suppose by mistake instead of typing values between 1 and 50 I type a letter. Then, the program crashes.
So i want some flexibility so that no letters are allowed. Only the values between 1 and 50. Is that possible?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|