编译错误
一个人从1990.1.1号开始打渔,三天打鱼,两天晒网,问到指定的某一天他是在打渔还是晒网?#include<stdio.h>
struct date{
int year;
int month;
int day;
};
void main()
{
struct date today,term;
int days(struct day);
int yearday,year,day;
printf("Enter year/month/day:");
scanf("%d%d%d",&today.year,&today.month,&today.day);
term.month=12;
term.day=31;
for(yearday=0,year=1990;year<today.year;year++){
term.year=year;
yearday+=days(term); /*计算从1990年至指定年的前一年共有过少天*/
}
yearday+=days(today); /*加上制定年到指定日期的天数*/
day=yearday%5; /*求余数*/
if(day>0&&day<4)printf("He was fishing at that day.\n");
else printf("He was sleeping at that day.\n");
}
int days(struct day)
struct date day;
{
static int day_tab[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,}, /*闰年*/
};
int i,lp;
lp=day.year%4==0&&day.year%100!=0||day.year%400==0;
for(i=1;i<day.month;i++)
day.day+=day_tab[lp][i];
return(day.day);
}
编译不能通过,那位大侠看看帮解决一下。谢谢