struct date today,term;
int main()
{ int yearday,term_year,day_year,days;
printf("Enter year/month/day:");
scanf("%d%d%d",&today.year,&today.month,&today.day);
term.month=12;
term.day=31;
yearday=0;
for(term_year=1991;term_year<today.year;term_year++)
{
date_day(day_year);
yearday+=date_day(day_year); /*计算从1990年至指定年的前一年共有过少天*/
}
yearday+=date_day(today); /*加上制定年到指定日期的天数*/
days=yearday%5; /*求余数*/
if(days>0&&days<4)/*将day改成days*/
printf("He was fishing at that day.\n");
else
printf("He was sleeping at that day.\n");
}
int main()
{ int yearday,term_year,day_year,days;
printf("Enter year/month/day:");
scanf("%d%d%d",&today.year,&today.month,&today.day);
term.month=12;
term.day=31;
yearday=0;
for(term_year=1991;term_year<today.year;term_year++)
{
date_day(day_year);
yearday+=date_day(day_year); /*计算从1990年至指定年的前一年共有过少天*/
}
yearday+=date_day(today); /*加上制定年到指定日期的天数*/
days=yearday%5; /*求余数*/
if(days>0&&days<4)/*将day改成days*/
printf("He was fishing at that day.\n");
else
printf("He was sleeping at that day.\n");
}
坚持做对的事情,而不是容易的事情。