case是不能运算么?只能printf?下面这种不可以么?
#include <stdio.h>
int main()
{
int year = 2008;
int month = 8;
int day = 8;
int sum = 0;
switch(month)
{
case 1:
sum += 31;
break;
case 2:
if(year%4==0)
{
sum += 29;
}
else
{
sum += 28;
}
break;
case 3:
sum += 31;
break;
case 4:
sum += 30;
break;
case 5:
sum += 31;
break;
case 6:
sum += 30;
break;
case 7:
sum += 31;
break;
}
int sum += 8;
printf(%d,sum);
return 0;
}