|
-
Jan 5th, 2006, 05:42 PM
#1
Thread Starter
New Member
If else- letters not allowed
[c]
Just want to be able to prevent my program from crashing when i input a letter.
I thought that when i use if else statement the program will take into account all the keys and not the numbers. This seems not to be the case. Then, i thought of declaring value as char instead of double. This does not work.
Value is of type double.
scanf("%lf",&value);
if(value < 1 || value > 50|| )
{
printf("not allowed\n");
printf("Please choose value between 0 and 90");
}
else
{
}
I thought that when i use 'if else' statement the program will take into account all the keys and not the numbers only. This seems not to be the case. Then, i thought of declaring 'value' as 'char' instead of 'double'. This does not work.
What i want is that ONLY the values between 0 and 50 are allowed.
[c]
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
|