计算年度第几天
2016-09-19 11:21
120 查看
/** * 输入某年某月某日,判断这一天是这一年的第几天 */ public int day(int year,int month,int day){ int date = 0; int arr[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) {//闰年 arr[1] = 29; } for (int i = 0; i < month - 1; i++) { date += arr[i]; } date += day; return date; }
相关文章推荐
- 计算某年是该年度的第几天(java)
- C语言习题 计算该日在本年中是第几天
- 输入年月日,计算该年第几天
- 日期计算第几天
- 结构体计算该日在本年中是第几天
- 定义一个结构体变量(包括年月日)。计算某日在一年中是第几天?(注意还要有闰年的判断)
- C/C++练习题 定义一个日期变量,进行年、月、日的输入,计算该日期是本年中的第几天。
- JS——计算某天是今年的第几天
- 计算某月某日为一年中第几天
- 计算第几天,无语了
- 计算日期是一年中的第几天(不用函数)
- 计算当年第几天
- 计算该日在本年中是第几天
- 第十六周 计算该日在本年中是第几天
- 第十六周-OJ-A计算该日在本年中是第几天
- 定义一个结构体变量(包含年月日),计算该日在本年中为第几天?要求写一个days函数。参数是此结构体类型的变量,返回值是整数。
- 输入某年的第几天,计算并输出它是这一年的第几月第几日
- switch语句练习——计算这一天是这一年的第几天
- 计算该日是该年的第几天