chenyonken
2015-12-26 12:28
采纳率: 0%
浏览 7.9k
已采纳

调用的函数leap是什么意思。leap(year)又是什么意思,是返回0或1吗?

#include
int main()
{
int sum_day(int month, int day);
int leap(int year);
int year, month, day, days;
printf("input date(year,month,day):");
scanf("%d%d%d",&year, &month, &day);
days = sum_day(month, day);
if (leap(year) && month >= 3)
days = days + 1;
printf("is the%th day in this year\n", days);
}
int sum_day(int month, int day)
{
int day_tab[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
int i;
for (i = 0; i < month; i++)
day += day_tab[i];//累加所在月之前的天数
return(day);
}
int leap(int year)
{
int leap;
leap = year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
return(leap);
}

1条回答 默认 最新

相关推荐 更多相似问题