#include <stdio.h>
int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day =8;
int d=day;
int February ;
if (year%4==0)
{
February=29;
}
else February=28;
switch (month)
{
case 1:day;break;
case 2:day+=31;break;
case 3:day+=31+February+30;break;
case 4:day+=31*2+February;break;
case 5:day+=31*3+February;break;
case 6:day+=31*3+February+30;break;
case 7:day+=31*3+February+30*2;break;
case 8:day+=31*4+February+30*2;break;
case 9:day+=31*5+February+30*2;break;
case 10:day+=31*5+February+30*3;break;
case 11:day+=31*6+February+30*3;break;
default:day+=31*6+February+30*4;break;
}
printf("%d年%d月%d日是该年中的第%d天。",year,month,d,day);
return 0;
判断闰年要(year%4==0&&year%400==0||year%4==0&&year%100!=0)