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 #include <cstdlib> #include <iostream> #include <math.h> using namespace std; int main(int argc, char *argv[]) { long menu() { long choix = 0; while (choix < 1 || choix > 4) { printf("Menu :\n"); printf("1 : Poulet de dinde aux escargots rotis a la sauce bearnaise\n"); printf("2 : Concombres sucres a la sauce de myrtilles enrobee de chocolat\n"); printf("3 : Escalope de kangourou saignante et sa gelee aux fraises poivree\n"); printf("4 : La surprise du Chef (j'en salive d'avance...)\n"); printf("Votre choix ? "); scanf("%ld", &choix); } return choix; } int main(int argc, char *argv[]) { switch (menu()) { case 1: printf("Vous avez pris le poulet\n"); break; case 2: printf("Vous avez pris les concombres\n"); break; case 3: printf("Vous avez pris l'escalope\n"); break; case 4: printf("Vous avez pris la surprise du Chef. Vous etes un sacre aventurier dites donc !\n"); break; } system("PAUSE"); return 0; }
Quand je compile il m'affiche sa
Aidé moi svp car sa fait un bye que je suis deçu et que je ne trouve pas !C:\Dev-Cpp\main.cpp In function `int main(int, char**)':
10 C:\Dev-Cpp\main.cpp `choix' undeclared (first use this function)
(Each undeclared identifier is reported only once for each function it appears in.)
At global scope:
28 C:\Dev-Cpp\main.cpp expected unqualified-id before "switch"
28 C:\Dev-Cpp\main.cpp expected `,' or `;' before "switch"
48 C:\Dev-Cpp\main.cpp expected constructor, destructor, or type conversion before '(' token
48 C:\Dev-Cpp\main.cpp expected `,' or `;' before '(' token
49 C:\Dev-Cpp\main.cpp expected unqualified-id before "return"
49 C:\Dev-Cpp\main.cpp expected `,' or `;' before "return"
50 C:\Dev-Cpp\main.cpp expected declaration before '}' token
C:\Dev-Cpp\Makefile.win [Build Error] [main.o] Error 1
Partager