int main()
{
/ 定义需要计算的日期 /
int year = 2008;
int month = 8;
int day = 8;/*
- 请使用switch语句,if...else语句完成本题
- 如有想看小编思路的,可以点击左侧任务中的“不会了怎么办”
- 小编还是希望大家独立完成哦~
*/
int days=day;
switch(month)
{
case 12:
day=30+day;
case 11:
day=31+day;
case 10:
day=30+day;
case 9:
day=31+day;
case 8:
day=31+day;
case 7:
day=31+day;
case 6:
day=31+day;
case 5:
day=30+day;
case 4:
day=31+day;
case 3:
if (year&4==0&&year%100!=0)
day=29+day;
else
day=28+day;
case 2:
day=31+day;
case 1:
day=day;
}
printf("%d年%d月%d日是该年的第%d天\n",year,month,days,day);
return 0;
}