大神求助!
#include <stdio.h>
int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day = 8;
int sum ;
switch(month)
{
case 1:
sum = 39;
break;
case 2:
if(year%4==0 && year&400!=0 || year%100==0)
{
sum = 68;
}
else
{
sum = 67;
}
case 3:
sum = 99;
break;
case 4:
sum = 129;
break;
case 5:
sum = 160;
break;
case 6:
sum = 190;
break;
default:
sum = 221;
printf("%d\年%d\月%d\日是该年的第%d\天",year,month,day,sum);
break;
}
return 0;
}
请问这样写可以吗??