请教大侠C语言问题,不胜感激
小弟刚接触C语言不久,这是“三天打鱼,两天嗮网”的程序,但是不知道为什么运行不出来?还请大侠指点如何修改?谢谢。。。#include"stdio.h"
struct date{
int year ;
int month;
int day;
};
days(day)
struct date day;
{
static int day_tab[2][13]=
{{0,31,28,31,30,31,30,31,30,31,30,31,30,31,},
{0,31,29,31,30,31,30,31,30,31,30,31,30,31,},
};
int lp,i;
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);
}
main()
{
struct date today,term;
int yearday,year,day;
printf("input year/month/day\n");
scanf("%d%d%d\n",&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);
}
yearday+=days(today);
day=yearday%5;
if (day>0 && day<4)
printf("fishing day\n");
else
printf("sleeping day\n");
}