im trying to check if the input is valid... i get non stop loop !!
this is the code:
*if i get into the loop and enter a letter it goes non stop !!
this is the code:
void one_game()
{
int NumOfMatches, Max, input,input2, round=0,num;
printf("\nNumber of matches: ");
input= scanf("%d",&NumOfMatches );
if (input<1)
printf("invalid input");
while (NumOfMatches <= 0)
{
printf("Number of matches: ");
input= scanf("%d",&NumOfMatches);
if (input<1)
printf("invalid input");
}
}
*if i get into the loop and enter a letter it goes non stop !!