#include <stdio.h>
int main()
{
int year,month,day,number ;
year=2008;
month=8;
day=8;
switch(month)
{
case 1:
number =31;
printf("%d",number );
case 2:
if ((year%4==0&&year%100!=0)||year%400==0)
{
number =number +29;
printf ("%d",number );
}
else
{
number=number+28;
printf ("%d",number );
}
case 3:
number+=31;
printf ("%d ",number );
case 4:
number+=30;
printf ("%d",number );
case 5:
number+=31;
printf ("%d",number );
case 6:
number+=30;
printf ("%d",number );
case 7:
number+=31;
printf ("%d",number );
case 8:
number+=day;
printf ("%d",number );
break ;
default :
printf ("A");
break ;
}
printf ("%d",number );
return 0;
}
前几个case都没有用break跳出