阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。 【说明】 下面程序的功能是计算并输出某年某月的天数,函数IsLeap Year()能够判断是否是闰年。 【C++程序】 # include < iostream > using namespa

admin2009-05-15  20

问题 阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。
【说明】
下面程序的功能是计算并输出某年某月的天数,函数IsLeap Year()能够判断是否是闰年。
【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) {
           this→year = year;
           if(  (2)  ) 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  (3)  ;{
                  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 Sop: case Nov: return 30;
           }
     }
     private:
           int year;
           Month month;
     };
     void main( ) {
     Date day(2000,Feb);
     cout < <day.   (5)   ( );
}

选项

答案(1)enum

解析 枚举类型变量month定义,这里填入enum。
转载请注明原文地址:https://kaotiyun.com/show/iwjZ777K
0

相关试题推荐
最新回复(0)