Bonjour
j'ai un crée un menu et quand je choisi 1 pour ajouter une personne
les 2 lignes nom et prénom apparaissent d'un coup et cela marche pas .
je voudrais c'est que quand choisi 1 on fois entrer le nom ensuite le prénom et après le téléphone .
je suis débutant...
Merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 #include <stdio.h> #include <stdlib.h> typedef struct { char nom[10]; char prenom[10]; char tel[10]; } fiche; void ajouter() { fiche s; printf("**Saisie d'une fiche** \n\n"); printf("Nom de la personne :\n"); gets(s.nom); printf("prenom de la personne : \n"); gets(s.prenom); printf("Numero de telephone : \n"); gets(s.tel); } int menu() { 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); return choix; } } int main() { switch (menu()) { case 1: ajouter(); } return 0; }
Partager