include <stdio.h>
int main()
{
int year = 2008;
int month = 8;
int day= 8;
int num=0;
switch(month)
{ case 1:num+=0;
case 2:num+=31;
case 3:num+=28;
case 4:num+=31;
case 5:num+=30;
case 6:num+=31;
case 7:num+=30;
case 8:num+=31;
case 9:num+=31;
case 10:num+=30;
case 11:num+=31;
case 12:num+=30;
break;
}
num=num+day;
if(year%4==0&&year%100!=0||year%400==0)
{ if(month>2)
{num++; printf("%d年%d月%d日这一天,是该年的第%d天",year,month,day,num);}
else
printf("%d年%d月%d日这一天,是该年的第%d天",year,month,day,num);
}
else
printf("%d年%d月%d日这一天,是该年的第%d天",year,month,day,num);
return 0;
}
case 后面缺break语句。这样会把后面的全都执行的