这样可以吧
#include <stdio.h>
int main()
{
int m,d,y,sum;
y=2008;
m=8;
d=8;
sum=0;
if(y%4==0)
{
switch(m-1)
{
case 12 :sum+=31;
case 11 :sum+=30;
case 10 :sum+=31;
case 9 :sum+=30;
case 8 :sum+=31;
case 7 :sum+=31;
case 6 :sum+=30;
case 5 :sum+=31;
case 4 :sum+=30;
case 3 :sum+=31;
case 2 :sum+=29;
case 1 :sum+=31;
break;
}
sum+=d;
printf("%d",sum);
}
else
{
switch(m-1)
{
case 12 :sum+=31;
case 11 :sum+=30;
case 10 :sum+=31;
case 9 :sum+=30;
case 8 :sum+=31;
case 7 :sum+=31;
case 6 :sum+=30;
case 5 :sum+=31;
case 4 :sum+=30;
case 3 :sum+=31;
case 2 :sum+=28;
case 1 :sum+=31;
break;
}
sum+=d;
printf("%d",sum);
}
return 0;
}