填空题
阅读以下说明和C函数,填充函数中的空缺。 [说明] 函数GetDateId(DATE date)的功能是计算并返回指定合法日期date是其所在年份的第几天。例如,date表示2008年1月25曰时,函数的返回值为25,date表示2008年3月3日时,函数返回值为63。 函数Kday_Date(int theyear,int k)的功能是计算并返回指定合法年份theyear(theyear≥1900)的第天(1≤k≤365)所对应的日期。例如,2008年的第60天是2008年2月29日,2009年的第60天是2009年3月1日。 函数isLeapYear(int y)的功能是判断y代表的年份是否为闰年,是则返回1,否则返回0。 DATE类型定义如下: typedef struct int year,month,day; DATE; [C函数1] int GetDateId(DATE date) Const int days_month[13]=(0,31,28,31,30,31,30,31,31,30,31,30,31); int i,date_id=date.day; for(i=0;i<______;i++) date_id+=days_month[i]; if(______&&isLeapYear(date.year))date_id++; return date_id;
[C函数2] ______Kday_Date(int theyear,int k)
int i; DATE date; int days_month[13]=(0,31,28,31,30,31,30,31,31,30,31,30,31); assert(k>=1&&k<=365&&theyear>=1900); /*不满足断言时程序终止*/ date.year=______; if(isLeapYear(date.year))days_month[2]++; for(i=1;;) k=k-davs_month[i++]; if(k<=0)(date.day=k+______;date.month=i-1;break;