问答题
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。
【说明】
下面程序的功能是计算并输出某年某月的天数,函数IsLeap Year()能够判断是否是闰年。
【C++程序】
#
include < iostream >
using namespace std;
{{U}}(1)
{{/U}} Month {Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
};
class Date {
public:
Date(
int year, Month m_ month) {
this→year = year;
if(
{{U}}(2) {{/U}}) month: Jan;
else month = m_ month;
};
~Date(){};
bool IsLeap Year( ) {
return ((year%4= =0 &&year% 100 ! =0)||
year%400= =0);
};
int
CaculateDays( ) {
switch(m_month )
{
case {{U}}(3)
{{/U}};{
if {{U}}(4) {{/U}}return 29;
else return 28;
}
case Jan: case Mar: case May: case Jul: case Aug: case Oct: case Dec:
return 31;
case Apr: case Jun: case
Sop: case Nov: return 30;
}
}
private:
int year;
Month month;
};
void
main( ) {
Date day(2000,Feb);
cout
< <day.{{U}} (5) {{/U}}( );
}