added all the verifications

Signed-off-by: Mathéo Hersan <matheohersan@MacBook-Pro-de-Matheo.local>
pull/3/head
Mathéo Hersan 2 years ago
parent 6c3bd40993
commit dc6e30a070
No known key found for this signature in database
GPG Key ID: 4EF19C64D78EC91B

BIN
app

Binary file not shown.

@ -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;
}

Loading…
Cancel
Save