@输出是肯定的.我想你不懂的应该是#&怎么会输出,因为你第一层switch的每一个别case都没有break;语句,所以第一层switch一旦匹配到一个case,就会执行后面的所有语句,即使碰到case也不进行比较,这是switch..case..的语法规则.
MSDN:Without break, the program continues to the next case, executing the statements until a break or the end of the statement is reached
测试:
int a=9;
switch( a )
{
case 9:
printf( "case9" );
case 8:
printf( "case8" );
case 7:
printf ("case7" );
}
输出 case9case8case7
再者:
int a=9;
switch( a )
{
case 8:
printf( "case8" );
case 9:
printf( "case9" );
case 7:
printf ("case7" );
}
输出:case9case7
可见若case后没有break则后面的case不是用来比较的而是直接执行.