Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Programming (http://www.go4expert.com/forums/programming-forum/)
-   -   switch problems (http://www.go4expert.com/forums/switch-problems-t26032/)

claude_tech 12Jun2011 16:43

switch problems
 
Hi,
i want to use two 'switch' in my code but it didn't work :
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");    };  breakcase'n': printf("2"); break;      default :        printf("WRONG CHOICE");  }; }
help please

claude_tech 12Jun2011 16:44

Re: switch problems
 
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");
 
};
}



All times are GMT +5.5. The time now is 04:27.