求问各位大佬,为什么会是运行成功输出错误呀,可以帮看看是什么原因吗?
#include <stdio.h>
int main()
{
int month = 8;
int day = 8;
int x,y,m;
int s = 0;
int year = 2008;
if(month>0)
{
if(year%4==0)
{
y = 29;
}
else
{
y =28;
}
switch(month)
{
case 1:
x=31;
break;
case 3:
x=31;
break;
case 2:
x = y;
break;
case 5:
x=31;
break;
case 7:
x=31;
break;
case 8:
x=31;
break;
case 4:
x = 30;
break;
case 6:
x = 30;
}
s = s + x;
month = month - 1;
}
else
{
m = s + day;
printf("2008年8月8号这一天,是该年中的第%d天",m);
}
return 0;
}