#include <stdio.h>
int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day = 8;
//先把月份确定了,把月份的日子算好
int monthday,flag;
switch(month)
{
case 1:monthday=0;break;
case 2:monthday=31;break;
case 3:monthday=59;break;
case 4:monthday=90;break;
case 5:monthday=120;break;
case 6:monthday=151;break;
case 7:monthday=181;break;
case 8:monthday=212;break;
case 9:monthday=243;break;
case 10:monthday=273;break;
case 11:monthday=304;break;
case 12:monthday=334;break;
default:printf("请输入12以内的月份");break;
}
//在计算日,加在一起就好
int sum;
sum=monthday+day;
if(year%400==0||(year%4==0&&year%100!==0))
flag=1;
else
flag=0;
if(flag==1&& month>2)
sum++;
printf("这一天是第%d天",sum);
return 0;
}
if(year%400==0||(year%4==0&&year%100!==0)) 好好看看这句话
最后一个不等于符号是这样写吗
太谢谢了!