Hi, i want to use two 'switch' in my code but it didn't work : Code: [COLOR=#339933]#include <stdio.h>[/COLOR] [COLOR=#0000ff]char[/COLOR] choix1,choix2; main() { printf([COLOR=#ff0000]"ENTER UR CHOICE :[COLOR=#800000]\n[/COLOR]"[/COLOR]); choix1 = getchar(); [COLOR=#0000ff]switch[/COLOR] (choix1) { [COLOR=#0000ff]case[/COLOR][COLOR=#ff0000]'y'[/COLOR]: printf([COLOR=#ff0000]"ENTER THE FILE :[COLOR=#800000]\n[/COLOR]"[/COLOR]); choix2=getchar(); [COLOR=#0000ff]switch[/COLOR] (choix2) { [COLOR=#0000ff]case[/COLOR][COLOR=#ff0000]'1'[/COLOR]: printf([COLOR=#ff0000]"'.bas' file"[/COLOR]); [COLOR=#0000ff]break[/COLOR]; [COLOR=#0000ff]case[/COLOR][COLOR=#ff0000]'2'[/COLOR]: printf([COLOR=#ff0000]"'.900' file"[/COLOR]); [COLOR=#0000ff]break[/COLOR]; [COLOR=#0000ff]default[/COLOR] : printf([COLOR=#ff0000]"WRONG CHOICE"[/COLOR]); }; [COLOR=#0000ff]break[/COLOR]; [COLOR=#0000ff]case[/COLOR][COLOR=#ff0000]'n'[/COLOR]: printf([COLOR=#ff0000]"2"[/COLOR]); [COLOR=#0000ff]break[/COLOR]; [COLOR=#0000ff]default[/COLOR] : printf([COLOR=#ff0000]"WRONG CHOICE"[/COLOR]); }; } help please
Code: #include <stdio.h> char choix1,choix2; main() { printf("ENTER UR CHOICE :\n"); choix1 = getchar(); switch (choix1) { case'y': printf("ENTER THE FILE :\n"); choix2=getchar(); switch (choix2) { case'1': printf("'.bas' file"); break; case'2': printf("'.900' file"); break; default : printf("WRONG CHOICE"); }; break; case'n': printf("2"); break; default : printf("WRONG CHOICE"); }; }