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