搜题
网友您好,请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
提问人:网友smallc 发布时间:2022-01-06
[单选题]

有以下程序: 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 prin

A.2

B.3

C.4

D.5

参考答案
简答题官方参考答案 (由简答题聘请的专业题库老师提供的解答)
查看官方参考答案
网友提供的答案
位网友提供了参考答案,
查看全部
  • · 有4位网友选择 C,占比40%
  • · 有3位网友选择 A,占比30%
  • · 有2位网友选择 D,占比20%
  • · 有1位网友选择 B,占比10%
匿名网友[66.***.***.197]选择了 C
1天前
匿名网友[167.***.***.100]选择了 A
1天前
匿名网友[225.***.***.71]选择了 D
1天前
匿名网友[11.***.***.9]选择了 B
1天前
匿名网友[62.***.***.53]选择了 D
1天前
匿名网友[125.***.***.113]选择了 A
1天前
匿名网友[134.***.***.78]选择了 C
1天前
匿名网友[82.***.***.26]选择了 C
1天前
匿名网友[123.***.***.20]选择了 A
1天前
匿名网友[252.***.***.245]选择了 C
1天前
提交我的答案
登录提交答案,可赢取奖励机会。
更多“有以下程序:Class Date{public:Date(int y,int m,mt d);{year=y;month=m;day=d;}Date(int y=2000”相关的问题
第1题
有以下程序:class Date{public:Date(int y, int m, int d); year = y; month = m; day = d;Date(

有以下程序: 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 = a.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 date 1 (2000,1,1),date2(0,0,0); Date date3(date 1); date2 = fun(date3); return 0; } 程序执行时,Date 类的拷贝构造函数被调用的次数是

A.2

B.3

C.4

D.5

点击查看答案
第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<<“.”<<mo

A.2

B.3

C.4

D.5

点击查看答案
第3题
有以下程序:#include<iostream>usingnamespacestd;staticintdays[]={31,28,31,30,31,30,31,31,30

有以下程序: #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+(iht 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 dl(6, 20, 2004 ), d2; d2 = dt + 20; d2.disp(); return 0; } 执行后的输出结果是()。

A.2004-7-10

B.2004-6-20

C.2004-7-20

D.程序编译时出错

点击查看答案
第4题
有以下程序#include <iostream>usingnamespacestd;static int days []={31,28.31,30,31,30,31,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 -= tays[ dt.month - 1 ]; if (dt.month == 13 { dt.month = 1; dt.yeare++; } } dr. day = day; return dt; } }; int main() { date d1(6, 20, 2004 ), d2; d2.= d1 + 20; d2.disp (); return 0; } 执行后的输出结果是

A.2004-7-10

B.2004-6-20

C.2004-7-20

D.程序编译时出错

点击查看答案
第5题
有以下程序#include <iostream>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-10

B.2004-6-20

C.2004-7-20

D.程序编译时出错

点击查看答案
第6题
有以下程序#include<iostream>using namespace std;static int days []={31,28,31,30,31,30,3l,3

有以下程序 #include<iostream> using namespace std; static int days []={31,28,31,30,31,30,3l,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; retrn dt; } }; int main() { date d1(6,20,2004),d2; d2=d1+20; d2.disp(); return 0; } 执行后的输出结果是

A.2004-7-10

B.2004-6-20

C.2004-7-20

D.程序编译时出错

点击查看答案
第7题
阅读以下说明和C++抖程序,将应填入(n)处的字句写在答题纸的对应栏内。【说明】 下面程序的功能是计

阅读以下说明和C++抖程序,将应填入(n)处的字句写在答题纸的对应栏内。

【说明】

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

【C++程序】

include<iostream>

using namespace std;

(1) Month{Jan,Feb,Mar,Art,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%1001!=0)‖year%400==0);

};

int CaculateDays(){

switch((3) ){

case Feb:{

if((4) )return29;

e1Se return 28;

}

case Jan:case Mar:case May:case Jul:case AUg:case Oct:

case Dec:retllrn 31;

case Apr:case Jun:Case Sep:case Nov:roturu30;

}

};

private:

int year;

Month month;

};

void main(){

Date day(2000,Feb);

tout<<day. (5) ();

}

点击查看答案
第8题
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。【说明】下面程序的功能是计算并输出某年

阅读以下说明和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) ();

}

点击查看答案
第9题
下列程序段中,正确的是______。①classMvClass{ int var = 100;static int getVar(){return var;}}

下列程序段中,正确的是______。 ①class MvClass { int var = 100; static int getVar() { return var; } } ②public class MyClass { final int date; void MyClass (int d) { date = d; } } ③public class MyMain { public static void main(String args[]) { System.out.println(Myclass1.date); } } class MyClass1 { int data = 10; } ④class IamAbstract { final int f; double d; abstrct void method(); }

A.②④

B.①③

C.②

D.以上都不对

点击查看答案
第10题
下面符合封装的概念的程序是()A、public class Date{private int year;public int getYear(){r

A.public class Date{private int year;public int getYear(){return year;}public void SetYear(int y){year=y;}} ;

B.protected class Date{private int year;public int getYear(){return year;}public void SetYear(int y){year=y;}} ;

C.public class Date{public int year;public int getYear(){return year;}public void SetYear(int y){year=y;}} ;

D.public class Date{private int year;private int getYear(){return year;}rivate void SetYear(int y){year=y;}}

点击查看答案
重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

功能 扣减规则
基础费
(查看答案)
加收费
(AI功能)
文字搜题、查看答案 1/每题 0/每次
语音搜题、查看答案 1/每题 2/每次
单题拍照识别、查看答案 1/每题 2/每次
整页拍照识别、查看答案 1/每题 5/每次

备注:网站、APP、小程序均支持文字搜题、查看答案;语音搜题、单题拍照识别、整页拍照识别仅APP、小程序支持。

2. 使用语音搜索、拍照搜索等AI功能需安装APP(或打开微信小程序)。

3. 搜题卡过期将作废,不支持退款,请在有效期内使用完毕。

请使用微信扫码支付(元)

订单号:

遇到问题请联系在线客服

请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示:请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

- 微信扫码关注简答题 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注简答题 -
请用微信扫码测试
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

简答题
下载APP
关注公众号
TOP