求某日是一年中的第几天 程序找错 运行不了
#include"stdio.h"#include"math.h"
int leap(int year)
{
if((year%4==0&&year%100!=0)||year%400==0)
return 1;
else
return 0;
}
int days(int y,int m,int d)
{
int i,j,sum=0,z;
int ruun[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int ping[12]={31,28,31,30,31,30,31,31,30,31,30,31};
z=leap(y);
if(z==1)
{
for(i=0;i<m-1;i++)
sum=sum+ruun[i];
}
else
{
for(j=0;j<m-1;j++)
sum=sum+ping[j];
}
sum=sum+d;
return sum;
}
main()
{
int days(int y,int m,int d)
int year,month,day,n;
printf("please input year:month:day\n");
scanf("%d%d%d,&year,&month,&day");
getchar();
n=days(year,month,day);
printf("%d-%d-%d is the %d day of this year!,year,month,day,n");
getchar();
}