大哥,这是考题啊,现在考题不都这样吗?
let me show you!!!!!!!
#include <stdio.h>
main()
{
int a=0,i;
for(i=
;i<5;i++)
{
switch(i)
{
case 0:
case 3:a+=2;
case 1:
case 2:a+=3;
default:a+=5;
}
}
printf("%d\n",a);
}
-----------------------------------------------------------------------------------------------------------------------------------------
循环5次: 1 2 3 4 5
a: 0->2->5=>10 10->13->18 18->20->23->28 28->33 33->38
run all case run 1,2,dflt run3,1,2,dflt run dflt run dflt
i: 0 1 2 3 4
the end--------38.
---------------这个题目我想是要培养你对swith下的break的重视吧.(今天我查的,不然也忘了
)