1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| #include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Menu
unsigned short menu()
{
char saisie[100];
unsigned short choix;
while(1)
{
printf("------- Gestion intineraire-------\n");
printf("1 : Saisir une ville \n");
printf("2 : saisir une distance \n");
printf("3 : Afficher le tableau \n");
printf("0 : Quitter");
printf("\nVotre choix ?");
fflush(stdout);
fgets(saisie, 100, stdin);
if (sscanf(saisie, "%hu", &choix) == 1 && choix >= 0 && choix <= 3)
break;
printf("Choix incorrect - Recommencez !!!\n");
}
return choix;
}
int main()
{
unsigned short choix;
while((choix=menu()) != 0)
{
switch (choix)
{
case 1:
break;
case 2:
break;
case 3:
break;
case 0:
break;
}
}
return 0;
} |
Partager