哪里错了?
哪里错了呢?求指点
#include <stdio.h>
int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day = 8;
int i,moo,sum=0;
for(i=1;i<month;i++)
{switch(i)
{ case 1:moo=31;break;
case 2:moo=28;break;
case 3:moo=31;break;
case 4:moo=30;break;
case 5:moo=31;break;
case 6:moo=30;break;
case 7:moo=31;break;
case 8:moo=31;break;
case 9:moo=30;break;
case 10:moo=31;break;
case 11:moo=30;break;
case 12:moo=31;break;
default:printf("一年中只有12个月哦,喵");break;
}
sum+=moo;
}
sum+=day;
if(year%100!=0&&year%4==0||year%400==0)
sum=sum+1;
printf("%d年%d月%d日是该年的第%d天",year,month,day,sum);
举报