给出日期计算该日是该年的第几天?求大神路过。。。
#include<stdio.h>int year,month,day,leap,sum=0;
int main()
{
int leaper(int years);
int summer(int date);
printf("输入年 月 日:\n");
scanf("%d%d%d",&year,&month,&day);
int leaper(int years);
int summer(int date);
printf("该日是%d年的第%d天\n",year,sum);
return 0;
}
int leaper(int years)
{
if(year%4==0)
{
if(year%100==0)
{
if(year%400==0)
leap=1;
else
leap=0;
}
else
leap=1;
}
else
leap=0;
return(0);
}
int summer(int date)
{
int leaper(int years);
int sum=0;
int b[12]={31,28,31,30,31,30,31,31,30,31,30,31};
if(month=0)
sum=day;
else if(year=leap){
for(month=1;month<12;month++)
sum=sum+b[month-1]+day+1;
}
else
sum=sum+b[month];
return(sum);
}