for(int i=1;i<month;i++){
switch(i){
case 1:dday = 31;break;
case 3:dday = 31;break;
case 5:dday = 31;break;
case 7:dday = 31;break;
case 8:dday = 31;break;
case 10:dday = 31;break;
case 12:dday = 31;break;
case 2:dday = 28;break;
default: dday = 30;break;
}
sum +=dday;
}
if(year%400==0||(year%4==0&&year%100!=0)){
flag=1;
}else{
flag=0;
}
printf("%d年%d月%d日是该年的第%d天\n",year,month,day,sum=sum+day+flag);
int i,d,days=0;
for(i=1;i<month;i++)
{
switch(i)
{
case 1:
case 3:
case 5:
case 7:
case 8:d=31;break;
case 4:
case 6:d=30;break;
case 2:if(year%4==0&&year%100!=0||year%400==0)d=29;else d=28;break;
}
days+=d;
}
printf("2008年8月8日是该年的第%d天\n",days+day);