Int main ()
{
Int a=3, b=7, c=5;
The switch (a> 0)
{
Case 1: swith (b<0)
{
Case 1: printf (" @ "); break;
Case 2: printf ("!" ); break;
}
Case 0: switch (c==5)
{
Case 0: printf (" * "); break;
Case 1: printf (" # "); break;
Case 2: printf (" $"); break;
}
Default: printf (" & amp;" );
}
printf("\n");
return 0;
}
Turn to
Programming has been D: \ \ desktop \ 0602. 8 c | | error: expected '; 'before' {' token |
CodePudding user response:
Case 1: swith (b<0), switch , for reference:# include
Int main ()
{
Int a=3, b=7, c=5;
The switch (a> 0)
{
Case 1: switch (b<0)//case 1: swith (b<0)
{
Case 1: printf (" @ "); break;
Case 2: printf ("!" ); break;
}
//break; If any missing break
Case 0: switch (c==5)
{
Case 0: printf (" * "); break;
Case 1: printf (" # "); break;
Case 2: printf (" $"); break;
}
//break; If any missing break
Default: printf (" & amp;" );
}
printf("\n");
return 0;
}
//# & amp;
//please press any key to continue...
CodePudding user response:
# include
Int main ()
{
Int a=3, b=7, c=5;
//the switch (a> 0)
The switch (a)
{
//case 1: swith (b<0)
Case 1: switch (b)
{
Case 1: printf (" @ "); break;
Case 2: printf ("!" ); break;
}
break;//add break
//case 0: switch (c==5)
Case 0: switch (c)
{
Case 0: printf (" * "); break;
Case 1: printf (" # "); break;
Case 2: printf (" $"); break;
}
break;//add break
Default:
Printf (" & amp;" );
}
printf("\n");
return 0;
}
For your reference ~
Switch attention to spelling, no less letter c
The switch () is a integer expression in brackets, not judging expression;
If you use a & gt; 0, the following case with two good case 0, 1 case because there are only two results,