结构体问题请教高手帮我看看
#include<stdio.h>struct
{
int year;
int month[12];
int day;
}days[2];
days[0].month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
days[1].month[12]={31,29,31,30,31,30,31,31,30,31,30,31};
void sxrn();
void dit();
void sxrn(int year)
{
if(year%4!=0)
printf("该年不是闰年");
else if(year%400==0 || year%4==0 && year%100!=0)
printf("该年为闰年");
}
void dit(int year,int month,int day)
{
int m,i,day_s=0;
if(year%400==0 || year%4==0 && year%100!=0)
m=1;
else if(year%4!=0)
m=0;
for(i=0;i<month-1;i++)
day_s+=days[m].month[i];
day_s=day_s+day;
printf("您输入的日期为该年的第%d天",day_s);
}
void main()
{
int year,month,day;
printf("请输入您要输入的日期");
while(1)
{
scanf("%d %d %d",&year,&month,&day);
if(month>=1 && month<=12)
break;
}
sxrn(year);
dit(year,month,day);
}
谢谢了