Hi,
how can i get input from a user (float) continuously and exit the loop if something not a number is entered
for example,
1 2 3 4.7 5 6 7 8 9
3 4 5
1 2 3 4 5 6.6
will kepp the program to get the number and process them after ENTER is press
But
1 2 3 a
will process the first 3 numbers and stop the top the program
my code:
scanf("%f", &num);
if (isalpha(num) != 0)
{
x1 = num;
}
else
{
display_area(y);
exit();
}
but it doesn't work
because num is not scaned if it's not a float
what should i do, thanks a lot