j'ai un probleme de boucle switch !!!!
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134 #include <stdio.h> #include <stdlib.h> #include "gestionpatient.h" int menugestionpatient() { int x; do { printf(" 1 ---> ajouter patient \n "); printf(" 2 ---> afficher liste des patients \n "); printf(" 3 ---> recherche patient \n "); printf(" 4 ---> suppression patient \n "); printf(" 0 ---> retour au menu principale \n "); printf("\n \n "); printf(" donner votre choix \n "); fflush(stdin); scanf("%d",&x); } while (x<0 || x>4); return x; } int choixmenuprincipal () { int x; do { printf(" 1 ---> gestion patient \n "); printf(" 2 ---> gestion salle d'attente \n "); printf(" 3 ---> gestion de payements \n "); printf(" 4 ---> gestion statistiques \n "); printf(" 0 ---> sortir de l'application \n "); printf("\n \n "); printf(" donner votre choix \n "); fflush(stdin); scanf("%d",&x); } while (x<0 || x>4); return x; } int main() { char chemin[]="/root/gestionpatient.txt"; int x1; int m; int n; x1=choixmenuprincipal(); printf("%d\n",x1); switch (x1) { case '1' : // system("cls"); m=menugestionpatient(); switch (m) { case '1' : system("cls"); printf(" donner le nombre de patient à ajouter \n "); scanf("%d",&n); creerFichierpatients(chemin,n); system("cls"); m=menugestionpatient(); break ; case '2' : system("cls"); afficherListepatients(chemin); system("cls"); m=menugestionpatient(); break ; case '3' : system("cls"); recherchepatient(chemin); system("cls"); m=menugestionpatient(); break ; case '4' : system("cls"); supprimerpatient(chemin); system("cls"); m=menugestionpatient(); break ; default : system("cls"); printf("appuer sur une touche pour quitter \n"); getchar(); exit(1); } system("cls"); x1=choixmenuprincipal(); break ; case '2' : system("cls"); system("cls"); x1=choixmenuprincipal(); break ; case '3' : system("cls"); system("cls"); x1=choixmenuprincipal(); break ; case '4' : system("cls"); system("cls"); x1=choixmenuprincipal(); break ; default : //system("cls"); printf("appuer sur une touche pour quitter \n"); getchar(); exit(1); } return 0; }
En effet aprés la saisie de choix de menu le programme exite directement !!!!!! la détection de premier choix ne s'effectue pas je ne sais pas pourquoi !!!
même avec l'affichage du contenu de x1 qui est juste le programme exite directement !!!
help please !!!!
Partager