软题库 移动APP 扫码下载APP 随时随地移动学习 培训课程
当前位置:信管网 >> 在线考试中心 >> 信息系统项目管理师题库 >> 试题查看
试卷名称 2005年上半年程序员考试下午真题试题(案例分析)
考试中心《2005年上半年程序员考试下午真题试题(案例分析)》在线考试
试卷年份2005年上半年
试题题型【分析简答题】
试题内容

【说明】
下面程序的功能是计算并输出某年某月的天数。
【C++程序】
#include < iostream>
using namespace std;
___(1)___ Month ( Jan , Feb , Mar , Apr , May , Jun , Jul , Aug , Sep , Oct , Nov , Dec ) ;
class Date {
public:
Date ( int year , Month m_month ) {
___(2)___ = year ;
if ( m_month < Jan || m_month > Dec ) month = Jan;
else month = m_month;
} ;
~Date () {} ;
bool IsLeapYear () {
return ( ( year % 4 = = 0&&year % 100 != 0 ) || year %400 = = 0);
};
int CaculateDays () {
switch ( ___(3)___ ) {
case Feb : {
if ( ___(4)___ ) 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 Sep : case Nov : return 30;
}
};
private :
int year;
Month month;
};
Void main () {
Date day ( 2000 ,Feb );
Cout << day. ___(5)___ ();
}


相关试题

推荐文章
合作网站内容