结构体题不通
这是一道结构体题斑竹帮我做了,没通,我改了,依然不通.,我找不到原因,请诸位帮忙
#include<stdio.h>
struct date
{
int year;
int month;
int day;
}a;
main()
{
printf("please input year,nonth,day");
scanf("%d,%d,%d",&a.year,&a.month,&a.day);
printf("There are %d days till %d month %d day\n",fun(a)+a.day,a.month,a.day);
}
int fun(a)
{
int i,leap=0,sum=0;
int num[2][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}};
if(a.year%4==0&&a.year%100!=0||a.year%400==0)
leap=1;
for(i=0;i<a.month;i++)
sum+=num[leap][i];
return sum;
}