当前位置:首页计算机类软件水平考试初级程序员->【说明】  下面程序的功能是计算并输出某年某月的天数。【C+

【说明】

  下面程序的功能是计算并输出某年某月的天数。

【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)___ ();

 }

查看答案 纠错
答案:
本题解析:

(1) enum

(2) this->year

(3) month

(4) IsleapYear()

(5) CaculateDays

更新时间:2021-12-14 15:00

你可能感兴趣的试题

单选题

( )is that it provides guidance and direction on how quality will be managed and verified throughout the project.

  • A.Plan Quality Management
  • B.Manage Quality
  • C.Control Quality
  • D.Project Charter
查看答案
单选题

( )the process of determining,documenting,and managing stakeholder needs and requirements to meet Project objectives.

  • A.Plan Scope Management
  • B.Collection Requirements
  • C.Validate Scope
  • D.Control Scope
查看答案
单选题

The information security management system preserves the confidentiality,integrity and availability of information by applying a( ).

  • A.technology management process
  • B.resource management process
  • C.quality management process
  • D.risk management process
查看答案
单选题

( )is a decentralized database,ensure that the data will not be tampered with and forged.

  • A.Artificial intelligence
  • B.Blockchain
  • C.Sensing technology
  • D.Big datA
查看答案
单选题

( )puts computer resources on the web,and must meet the requirements of super capacity,super concurrency,super speed and super security.

  • A.Cloud computing
  • B.Big datA
  • C.Blockchain
  • D.Internet of things
查看答案
单选题

分配甲、乙、丙、丁四个人去完成五项任务。每人完成各项任务时间如表所示。由于任务多于人数,故规定其中有一个人可兼完成两项任务,其余三人每人完成一项。为了花费时间最少,( )应该完成两项任务。

高级信息系统项目管理师,历年真题,2021年下半年《信息系统项目管理师》真题

  • A.甲
  • B.乙
  • C.丙
  • D.丁
查看答案
单选题

已知某公司生产AB两种产品,其中生产1件A产品需要1个单位的甲资源,3个单位的丙资源;生产1件B产品需要2个单位的乙资源和2个单位的丙资源。已知现有甲乙丙三种资源4个单位、12个单位和18个单位。通过市场预测,可知A产品的单位市场利润为2元,B产品的单位市场利润为5元。该公司获得最大的市场利润应生产A产品(68)件,此时(69)资源仍有剩余。

  • A.甲
  • B.乙
  • C.丙
  • D.甲及丙
查看答案
单选题

已知某公司生产AB两种产品,其中生产1件A产品需要1个单位的甲资源,3个单位的丙资源;生产1件B产品需要2个单位的乙资源和2个单位的丙资源。已知现有甲乙丙三种资源4个单位、12个单位和18个单位。通过市场预测,可知A产品的单位市场利润为2元,B产品的单位市场利润为5元。该公司获得最大的市场利润应生产A产品(68)件,此时(69)资源仍有剩余。

  • A.0
  • B.2
  • C.4
  • D.6
查看答案
单选题

某项目2016年投资额12万元,2018年开始取得项目的净收益(产品一原料辅料及公用工程)6万元/年,2018-2021年每年还会产生其他成本(包括人员工资、管理成本、制造成本等)1.1万元/年;増值税0.35万元/年、营业税金及附加0.05万元/年。则该项目的静态投资回收期为(66)年,截止到2021年底该项目的投资收益率是(67)。

  • A.0.25
  • B.0.33
  • C.0.35
  • D.0.6
查看答案
单选题

安全审计的手段主要包括( )。

  • A.①②③
  • B.②③④
  • C.①②④
  • D.①③④
查看答案