DATE的函数值等于YEAR()函数、MONTH()函数、DAY()函数的函数值之和。
DATE的函数值等于YEAR()函数、MONTH()函数、DAY()函数的函数值之和。
相关考题:
有以下程序: Class Date { public: Date(int y,int m,mt d); { year=y; month=m; day=d; } Date(int y=2000) { year=y; month=10; day=1; } Date(Date D) { year=d.year; month=d.month; day=d.day; } Void prinA.2B.3C.4D.5
有以下程序:class Date{public:Date(int y,int m,int d);{year=y;month=mday=d;}Date(int y=2000){year=y;month=10;day=1;}Date(Date d){year=d.year;month=d.month;day=d.day;}void print( ){cout<<year<<"."<<month<<"."<<day<<endl;}private:int year,month,day;};Date fun(Date d){Date temp;temp=d;return temp;}int main( ){Date datel(2000,1,1),date2(0,0,0);Date date3(datel);date2=fun(date3);return 0;}程序执行时,Date类的拷贝构造函数被调用的次数是A.2B.3C.4D.5
给定日期DD,可以计算该日期当月最大天数的正确表达式是______.A.Day(DD)B.Day (Date Serial(Year(DD) Month(DD) ,day(DD) ))C.Day (Date Serial(Year(DD) Month(DD),0))D.Day(Date Serial(Year(DD) ,Month(D D)+1,0))
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。【说明】设计一个日期类Date包括年、月、日等私有数据成员。要求实现日期的基本运算,如某日期加上天数、某日期减去天数、两日期相差的天数等。在Date类中设计如下重载运算符函数:Date operator + (int days) : 返回某日期加上天数得到的日期。Date operator - (int days) : 返回某日期减去天数得到的日期。int operator - (Dateb): 返回两日期相差的天数。【程序】include<iostream.h>int day tab[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};//day_tab二维数组存放各月天数,第一行对应非闰年,第二行对应闰年class Date{int year, month, day //年,月,日int leap(int); //判断是否闰年int dton(Date)Date ntod(int)public:Date() { }Date (int y, int mint d) I year = y; month = m; day = d;}void setday(intd){day = d;}void setmonth(int m) {month = m;}void setyear(int y) {year =y;}int getday() {return day;}int getmonth() {return month:}int getyear() {return yea;}Date operator + (int days) //+运算符重载函数{static Date date;int number =(1)date = ntod(number)return date}Date operator - (int days) //-运算符重载函数{staffs Date date;int number=(2);number - = days;date = ntod(number)return date;}int operator - (Date b) //-运算符重载函数{int days=(3);return days;}void disp(){cout<<year<<"."<<month<<". "<<day<<endl;}};int Date: :leap( int year)if((4)) //是闰年return 1; //不是闰年elsereturn0:}int Date:: dton( Date d) //求从公元0年0月0日到d日期的天数{inty,m,days =0;for(y=1;y<=d. year;y++)if((5))days+ =366; //闰年时加366天else days + = 365; //非闰年时加365天for(m =0;m<d. month-1;m++)if((6))days += day_tab[1] [m];elsedays +=day_tab[0] [m];days + = d. day;return days;}Date Date::ntod(intn) //将从元0年0月0日的天数转换成日期{int y=1,m = 1,d,rest = n,lp;while(1){ if(leap(y))if(rest<= 366) break;else rest - = 366;else //非闰年if(rest = 365 ) break;else rest-=365;
有以下程序: class Date { public: Date(int y,int m,int D) ; { year =y; month=m; day=d; } Date(int y=2000) { year=y; month=10; day=1; } Date(Date D) { year=d.year; month=d.month; day=d.day; } void print () { cout<<year<<"."<<month<<"."<<day<<end1; } private: int year,month,day; }; Date fun(Date D) { Date temp; temp=d; return temp; } int main() { Date date1(2000,1,1),date2(0,0,0); Date date3(date1); date2=fun(date3); return 0; } 程序执行时,Date类的拷贝构造函数被调用的次数是A.2B.3C.4D.5
下面结构体的定义语句中,不正确的是______。A.structdate { int month; int day; int year; } Struct date datel;B.stmctdate { intmonth; int day; int year; } datel;C.struct { int month; int day; int year; } date 1;D.#define DATE stmct date DATE { int month; int day; int year; }datel;
有以下程序include using namespace std;static int days[]= { 31,28,31,30,31,30,31 有以下程序 #include <iostream> using namespace std; static int days[]= { 31,28,31,30,31,30,31,31,30,31,30,31 }; class date { private: int month, day, year; public: date( int m, int d, int y ) { month = m; day = d; year = y; } date() {} void disp() { cout<<year<<"-"<<month<<"-"<<day<<end1; } date operator+( int day ) { date dt = *this; day+= dt.day; while ( day > days[dt.month - 1 ] ) { day -= days[ dt.month - 1 ]; if ( ++dt.month == 13 ) { dt.month = 1; dt.year++; } } dt.day = day; return dt; }; int main() { date d1( 6, 20, 2004 ), d2; d2: d1 + 20; d2.disp(); return 0; } 执行后的输出结果是A.2004-7-10B.2004-6-20C.2004-7-20D.程序编译时出错
有以下程序: classDate {public: Date(inty,intm,intd); {year=Y; month=m; day=d;} Date(inty=2000) {year=y; month=10; day=1;} Date(Date&d) {year=d.year; month=d.month; day=d.day;} voidprint() {coutyear"."month"." dayendl;} private: intyear,month,day;}; Datefun(Dated) {Datetemp; temp=d; returntemp;} intmain() {Datedatel(2000,1,1),date2(0,0,O); Datedate3(date1); date2=fun(date3); return0;} 程序执行时,Date类的复制构造函数被调用的次数是( )。A.2B.3C.4D.5
阅读以下说明和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) ( );}
NextDate 函数包含三个变量:month 、 day 和 year ,函数的输出为输入日期后一天 的日期。 例如,输入为 2006年3月 7日,则函数的输出为 2006年3月8日 。 要求输入变量 month 、 day 和 year 均为整数值,并且满足下列条件: (1)1≤month≤12 (2)1≤day≤31 (3)1912≤year≤2050 (1) 给出边界值健壮性测试的测试用例 (2)给出边界值最坏情况测试和边界值健壮最坏情况测试的测试用例个数
有以下程序: Class Date {public: Date(int y,int m,int d); {year=y; month=m; day=d;} Date(int y=2000) {year=y; month=10; day=1;) Date(Date D) {year=d.year; month=d.month; day=d.day;} void print() {cout<<year<<“.”<<moA.2B.3C.4D.5
有以下程序: classDate { public: Date(inty,intm,intd); { year=Y: month=m; day=d; } Date(inty=2000) { year=y; month=10; day=1; } Date(Date&d){ year=d.year; month=d.month; day=d.day; } voidprint( ) { coutyear"."(month"."dayendl; } private: intyear,month,day; }; Datefun(Dated) { Datetemp; temp=d; returntemp; } intmain( ) { Datedatel(2000,1,1),date2(0,0,0); Datedate3(datel); date2=fun(date3); return0; } 程序执行时,Date类的拷贝构造函数被调用的次数是( )。A.2B.3C.4D.5
判断题DATETIME()的函数值等于DATE()函数与TIME()函数之和。A对B错