即便将case 8:中改成212+day:仍然错误;求大神看看
#include <stdio.h>
int main()
{
int year = 2008;
int month = 8;
int day = 8;
/*
* 请使用switch语句,if...else语句完成本题
* 如有想看小编思路的,可以点击左侧任务中的“不会了怎么办”
* 小编还是希望大家独立完成哦~
*/
int i;
switch(month)
{
case 1:i=day;break;
case 2:i=31+day;break;
case 3:i=31+28+day;break;
case 4:i=31+28+31+day;break;
case 5:i=31+28+31+30+day;break;
case 6:i=31+28+31+30+31+day;break;
case 7:i=31+28+31+30+31+30+day;break;
case 8:i=31+28+31+30+31+30+31+day;break;
case 9:i=31+28+31+30+31+30+31+31+day;break;
case 10:i=31+28+31+30+31+30+31+31+30+day;break;
case 11:i=31+28+31+30+31+30+31+31+30+31+day;break;
case 12:i=31+28+31+30+31+30+31+31+30+31+30+day;break;
}
if(year/4==0&&month>3&&year%100!=0)
{
i++;
printf("天数是%d",i);
}
else
{
printf("天数是%d",i);
}
return 0;
}