How would I be able to clear the buffer if a character or more is entered in this block of code.
int x = 1;
float grade = 0.0;
do
{
printf ("Enter a grade for quiz %d: ", x);
scanf ("%f", grade);
if (grade >= 1 && grade <= 10) break;
printf ("Entry not valid. Please try again\n");
} while (1);
My instructor is insisting that we use fflush(stdin). This I know wont work, and I called him out on it. What other ways could I just to validate if a number is entered or not.