大一,求找错
//用函数的方法计算输入的某年某日是这一年中的第几天。#include<stdio.h>
void main()
{
int year,mon,day,num;
int run(int year);
int tian(int x,int y,int z);
scanf("%d%d%d",&year,&mon,&day);
num=tian(year,mon,day);
printf("%d年第%d天",year,num);
}
int run(int year)
{
int leap;
if(year%4==0 && year%100!=0 || year%400==0)
leap=1;
else
leap=0;
return (leap);
}
int tian(int year,int mon,int day)
{
int run(int x);
int a[12];
int b[12];
int i,c=0;
a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
b[12]={31,29,31,30,31,30,31,31,30,31,30,31};
if(run(year)==1)
{
for(i=1;i<mon ;i++)
{
c=c+a[i];
}
}
else
for(i=1;i<mon;i++)
{
c=c+b[i];
}
c=c+day;
return (c);
}