I already tried a lot of things to validade an user input, I need to validate the input to be an integer.. I search for days and can't do that, and it might be that dificult...
Already tried with "isdigit", already tried read as string and convert to integer, well dont know how to do this..
Any help :confused:
my try:
....
available = 10;
contador2 = 0;
for(;;)
{
printf(" ## insert number you want\n");
scanf("%d", &chosen);
if(chosen>=available)
printf(" ## invalid input\n");
if(chosen < contador2)
printf(" ## invalid input\n");
else
break;
}
..........
Problem.. if I insert any character diferent of number(integer), it makes the chosen = 1.. I want to just exit from loop when I have a real input of number... between 0 and 10.
Edited by dargueta, 27 December 2011 - 01:11 AM.


Sign In
Create Account

Back to top









