C语言编程高手:输入年份year和月month,求该月有多少天。用C语言写程序...答:int GetDays(int nYear, int nMonth){ //参数越界检查(nMonth输入为1~12)if (nMonth <= 0 || nMonth > 12){ return 0;} //每个月的天数 int anMonthDay[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};//闰年的2月是29天 if((nYear % 4 == 0) && ...
c语言输入年,月,日,判断该日期是当年的第几天?答:=0)||year%400==0) return 2; else return 1; }int jisuan (int year,int month) //计算当月之前度过的日子{ int x,i,s=0; int date[2][12]= { {31,28,31,30,31,30,31,31,30,31,30,31}, {31,29,31,30,31,30,31,31,30,31,30,31} ...
c语言:输入年份和第多少天,求该天是该年的第几月,几日答:对输入的年份和天数都作了合法性的检查 include<stdio.h> //平年 int nonLeap[13] = {0,31,59,90,120,151,181,212,243,273,304,334,365};闰年 int leap[13] = {0,31,60,91,121,152,183,213,244,274,305,335,366};int leapyear(int year) //判断某年是否闰年 闰年返回1,平年...