Bonjour,
je commence a peine à apprendre le langage C,
a part ça je ne m'y connais pas vraiment.
Enfin bref j'ai commencé a me faire un petit programme menu:
et le debugger m'affiche
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 #include <stdio.h> #include <stdlib.h> int main() { int menu = 0; printf("\n\n == Menu== \n\n"); printf("\t1. Cheezburger\n"); printf("\t2.Chocapic et beaujolais\n"); printf("\t3.De l'huile\n"); printf("\t4. Un whisky"); printf("\n\n\n\n Votre choix?"); scanf("%d", &menu); switch (menu); { case 1: printf("\n\nOuais, mon chat ma demandé la meme..."); break; case 2: printf("\n\nChasseur dans l'ame"); break; case 3: printf("\n\nLes enfant sont adorrables."); break; case 4: printf("\n\ntu te prends pour un 'ricain toi maintenant?"); printf("\n\n == Menu== \n\n\t1. Cheezburger\n\t2.Chocapic et beaujolais\n\t3.De l'huile\n\t4. Un Ricard\n\n\n\n Votre choix?"); int menu4 =0; scanf("%d", &menu4); switch (menu4); { case 1: printf("\n\nOuais, mon chat ma demandé la meme..."); break; case 2: printf("\n\nChasseur dans l'ame"); break; case 3: printf("\n\nLes enfant sont adorrables."); break; case 4: printf("\n\nVoila, enfin une boisson d'homme..."); break; default: printf("\n\nQu'est-ce tu raconte?"); break; } break; default: printf("Qu'est-ce tu raconte?"); break; } return 0; }
Pourriez vous m'aider s'il vous plait?-------------- Build: Debug in bordel ---------------
Compiling: main.c
C:\...\main.c: In function 'main':
C:\...\main.c:18: error: case label not within a switch statement
C:\...\main.c:20: error: break statement not within loop or switch
C:\...\main.c:21: error: case label not within a switch statement
C:\...\main.c:23: error: break statement not within loop or switch
C:\...\main.c:24: error: case label not within a switch statement
C:\...\main.c:26: error: break statement not within loop or switch
C:\...\main.c:27: error: case label not within a switch statement
C:\...\main.c:36: error: case label not within a switch statement
C:\...\main.c:38: error: break statement not within loop or switch
C:\...\main.c:39: error: case label not within a switch statement
C:\...\main.c:41: error: break statement not within loop or switch
C:\...\main.c:42: error: case label not within a switch statement
C:\...\main.c:44: error: break statement not within loop or switch
C:\...\main.c:45: error: case label not within a switch statement
C:\...\main.c:47: error: break statement not within loop or switch
C:\...\main.c:48: error: 'default' label not within a switch statement
C:\...\main.c:50: error: break statement not within loop or switch
C:\...\main.c:52: error: break statement not within loop or switch
C:\...\main.c:53: error: 'default' label not within a switch statement
C:\...\main.c:55: error: break statement not within loop or switch
Process terminated with status 1 (0 minutes, 0 seconds)
20 errors, 0 warnings
Merci d'avance
Bon bas finalement, j'ai réussi a réglé le problème tout seul meme si je voit pas vraiment la difference
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 #include <stdio.h> #include <stdlib.h> int main() { int menu = 0; printf("\n\n == Menu== \n\n"); printf("\t1. Cheezburger\n"); printf("\t2.Chocapic et beaujolais\n"); printf("\t3.De l'huile\n"); printf("\t4. Un whisky"); printf("\n\n\n\n Votre choix?"); scanf("%d", &menu); switch (menu) { case 1: printf("\n\nOuais, mon chat ma demandé la meme..."); break; case 2: printf("\n\nChasseur dans l'ame"); break; case 3: printf("\n\nLes enfant sont adorrables."); break; case 4: printf("\n\ntu te prends pour un 'ricain toi maintenant?"); printf("\n\n == Menu== \n\n\t1. Cheezburger\n\t2.Chocapic et beaujolais\n\t3.De l'huile\n\t4. Un Ricard\n\n\n\n Votre choix?"); int menu4 =0; scanf("%d", &menu4); switch (menu4) { case 1: printf("\n\nOuais, mon chat ma demandé la meme..."); break; case 2: printf("\n\nChasseur dans l'ame"); break; case 3: printf("\n\nLes enfant sont adorrables."); break; case 4: printf("\n\nVoila, enfin une boisson d'homme..."); break; default: printf("\n\nQu'est-ce tu raconte?"); break; } break; default: printf("Qu'est-ce tu raconte?"); break; } return 0; }
Partager