结构体做输入年月日,输出这年第几天,结果不对
什么地方有问题啊???#include"stdio.h"
int main(){
int month,dates,i;
struct dd{
int year;
int month[12];
int day;
}day_date={0,{31,28,31,30,31,30,31,31,30,31,30,31},0};
printf("输入年-月-日\n");
scanf("%d-%d-%d",&day_date.year,&month,&day_date.day);
if((!(day_date.year%4)&&day_date.year%100)||!(day_date.year%400))
{day_date.month[1]=29;
for(i=0;i<month-1;i++)
{dates+=day_date.month[i];}}
else {for(i=0;i<month-1;i++)
{dates+=day_date.month[i];};
}
dates=dates+day_date.day;
printf("%d",dates);
}