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 50 51 52 53 54
| #include <stdio.h>
#include <stdlib.h>
#define BUF_SIZE 10
typedef struct
{
char nom[BUF_SIZE];
char prenom[BUF_SIZE];
char tel[BUF_SIZE];
} fiche;
void ajouter(void)
{
fiche s;
printf("**Saisie d'une fiche** \n\n");
printf("Nom de la personne :\n");
fgets (s.nom, BUF_SIZE, stdin);
printf("prenom de la personne : \n");
fgets (s.prenom, BUF_SIZE, stdin);
printf("Numero de telephone : \n");
fgets (s.tel, BUF_SIZE, stdin);
}
int menu(void)
{
int choix =0;
while(choix < 1 || choix > 3)
{
printf("------- Repertoire 2013-------\n");
printf("1 : Ajouter une fiche \n");
printf("2 : Lire une fiche \n");
printf("3 : Quitter");
printf("Votre choix ?");
scanf("%d",&choix);
fflush(stdin);
}
return choix;
}
int main (void)
{
switch (menu())
{
case 1:
ajouter();
break;
}
return EXIT_SUCCESS;
} |