int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day1 = 8;
int m,day,day2;
if (2008%400==0||year%4==0 && year%100!=0)
m==29;
else
m==28;
switch(month)
{
case 1:day=0;break;
case 2:day=31;break;
case 3:day=m+31;break;
case 4:day=31+m+31;break;
case 5:day=31+m+31+30;break;
case 6:day=31+m+31+30+31;break;
case 7:day=31+m+31+30+31+30;break;
case 8:day=31+m+31+30+31+30+31;break;
case 9:day=31+m+31+30+31+30+31+31;break;
case 10:day=31+m+31+30+31+30+31+31+30;break;
case 11:day=31+m+31+30+31+30+31+31+30+30;break;
case 12:day=31+m+31+30+31+30+31+31+30+30+31;break;
day2=day+day1
printf("%d年%d月%d日这一天,是该年中的第%d天。"year,month,day1,day2);
return 0;
int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day1 = 8;
int m,day,day2;
if (2008%400==0||year%4==0 && year%100!=0)
m=29;
else
m=28;
switch(month)
{
case 1:day=0;break;
case 2:day=31;break;
case 3:day=m+31;break;
case 4:day=31+m+31;break;
case 5:day=31+m+31+30;break;
case 6:day=31+m+31+30+31;break;
case 7:day=31+m+31+30+31+30;break;
case 8:day=31+m+31+30+31+30+31;break;
case 9:day=31+m+31+30+31+30+31+31;break;
case 10:day=31+m+31+30+31+30+31+31+30;break;
case 11:day=31+m+31+30+31+30+31+31+30+30;break;
case 12:day=31+m+31+30+31+30+31+31+30+30+31;break;
}
day2=day+day1;
printf("%d年%d月%d日这一天,是该年中的第%d天。",year,month,day1,day2);}