错在哪?
#include<iostream.h>struct date
{
int mont;
int day;
int year;
}
tad[][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},
{0,31,289,31,30,31,30,31,31,30,31,30,31}};
int dofy(struct date *p)
{
int k,i,day;
day=p->day;
k=p->year%4==0&&p->year%100!=0||p->year%400==0;
for(i=0;i<p->mont;i++)
day+=tad[k][i];
return day;
}
void main()
{
date sdate;
cout<<"input the year: ";
cin>>date.year;
cout<<"input the month:";
cin>>date.mont;
cout<<"input the day: ";
cin>>date.day;
cout<<"这是该年的第"<<dofy(&date)<<"天!"<<endl;
}