diff --git a/app b/app index 393b16d..26c8c71 100755 Binary files a/app and b/app differ diff --git a/src/main.c b/src/main.c index 3ec03e6..9db7ce4 100644 --- a/src/main.c +++ b/src/main.c @@ -10,15 +10,22 @@ int choixInterface(void) { printf("Choix de l'interface: \n"); printf("1. Interface 'responsable': Pour les responsables \n"); printf("2. Interface 'Client' : Pour les clients\n"); - printf("Vous choisissez l'interface n°: "); - scanf("%d", &choix); - if (choix < 0 || choix > 1) { - fprintf(stderr,"Veuillez entrer un choix valide ! \n"); + + while (1) { + printf("Vous choisissez l'interface n°: "); + if (scanf("%d", &choix) != 1 || (choix < 1 || choix > 2)) { + printf("ERREUR : Veuillez entrer un choix valide (1 ou 2) : "); + while (getchar() != '\n'); + } else { + break; + } } + switch (choix) { - case 1: printf("Vous avez choisit l'interface responsable.\n"); - case 2: printf("Vous avez choisit l'interface client.\n"); + case 1: printf("Vous avez choisi l'interface responsable.\n"); break; + case 2: printf("Vous avez choisi l'interface client.\n"); break; } + return choix; }