Hi,
So I get this simple thing here, meant to get a number between 1 and 12. The problem is, in my program, if I enter a character, I get an infinite loop and I just can't find a way to fix it. Any idea?
Code:
int demanderposition1()
{
int position1=1;
do
{
if(position1<=0 || position1>12)
{
printf("Erreur de saisie, veuillez recommencer.\n");
}
printf("Faites votre 1er choix de position entre 1 et 12 :");
fflush(stdin);
scanf("%d", &position1);
}while((position1<=0 || position1>12));
return position1;
}