C语言 从键盘输入年号和月号,计算这一年的这一月共有几天。答:事实上,除了闰年的2月外,其它各个月的天数都是固定的。所以,除了对2月特殊判断一下是否为闰年外,其它均可直接输出。方便起见,将每月天数存在数组中,以减少代码量,并提高效率。include <stdio.h>int main(){ int m,y; int days[12] = {31, 28, 31,30,31,30,31,31,30,31,30...
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) && ...