关于switch中的default,为什么我定义的default不起作用啊
#include<stdio.h>void main()
{
int year,month,day;
int leap;
printf("please input year,month,day:");
scanf("%d%d%d",&year,&month,&day);
switch(month)
{
case 12:
day+=30;
case 11:
day+=31;
case 10:
day+=30;
case 9:
day+=31;
case 8:
day+=31;
case 7:
day+=30;
case 6:
day+=31;
case 5:
day+=30;
case 4:
day+=31;
case 3:
day+=28;
case 2:
day+=31;
case 1:
day=day;
default:
printf("please input error:\n");
break;
}
if((year%400==0 || year%4==0 &&year%100!=0) && month>2)
leap=1;
else
leap=0;
if(leap=1 && month>2)
day++;
printf("\nday=%d\n",day);
}