快乐学习 一个网站喵查铺子(catpuzi.com)全搞定~

下面程序中子函数MonthDay()的功能是将某年的第几天转换为某月某日。程序的运行结果如下:Please enter year, yearDay:2014,100↙month = 4, day = 10按要求在空白处填写适当的表达式或语句,使程序完整并符合题目要求。#include     void  MonthDay(int year, int yearDay, int *pMonth, int *pDay); int dayTab[2][13] = {{0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}}; int main()      {     int year, month, day, yearDay;     printf("Please enter year, yearDay:");     scanf("%d,%d", &year, &yearDay);     _________________;     printf("month = %d, day = %d\n", month, day);      return 0;   } /* 函数功能:对给定的某一年的第几天,计算它是这一年的第几月第几日 */ void  MonthDay(int year, int yearDay, int *pMonth, int *pDay) {       int  i, leap;     leap = _________________________;          for (i=1; yearDay>dayTab[leap][i]; i++)     {         yearDay = ______________________;     }     ______________;        /* 将计算出的月份值赋值给pMonth所指向的变量 */          *pDay = yearDay;   /* 将计算出的日号赋值给pDay所指向的变量 */ }

中国大学MOOC答案 数据帝 2024-04-09 扫描二维码

A、第10行: MonthDay(year, yearDay, &month, &day)第19行: ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)第23行: yearDay – dayTab[leap][i]第25行: *pMonth = i
B、第10行: MonthDay(year, yearDay, month, day)第19行: ((year % 4 == 0) || (year % 100 != 0)) || (year % 400 == 0)第23行: yearDay – dayTab[leap][i]第25行: pMonth = i
C、第10行: MonthDay(&year, &yearDay, &month, &day)第19行: ((year % 4 == 0) || (year % 100 != 0)) && (year % 400 != 0)第23行: yearDay + dayTab[i][leap]第25行: *pMonth = i
D、第10行: MonthDay(&year, &yearDay, month, day)第19行: ((year % 4 == 0) && (year % 100 == 0)) || (year % 400 == 0)第23行: yearDay – dayTab[i][leap]第25行: pMonth = i
喵查答案:第10行: MonthDay(year, yearDay, &month, &day)第19行: ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)第23行: yearDay – dayTab[leap][i]第25行: *pMonth = i

喜欢 (0)
关于作者: