首页 > 计算机等级考试
题目内容 (请给出正确答案)
[主观题]

有如下程序:#includeUsing namespace std;class Base{public:Base(intx=0):valB(x){cout<<valB;}

有如下程序: #include Using namespace std; class Base{ public: Base(intx=0):valB(x){cout<<valB;} ~Base()(cout<<valB;) Private: intvalB; }; class Derived:public Base{ public: Derived(int x=O,int y=O):Base(x),va1D(y)(cout<<valD;) ~Derived()(cout<<va1D;) private: int valD; int main(){ Derived obj 12(2,3); return 0; } 运行时的输出结果是()。

A.2332

B.2323

C.3232

D.3223 .

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“有如下程序:#includeUsing namespace …”相关的问题
第1题
有如下程序:#inCludeusing nameSpace std;Class A{public:A(inti=0):r1(i){}void plint(){cout&l

有如下程序: #inClude using nameSpace std; Class A{ public: A(inti=0):r1(i){ } void plint(){cout<<‘E’<<r1<<‘-’;} void print()const{cout<<‘C’<<r1*r1<<‘-’;} void print(int X){cout<<‘P’<<r1*r1*r1<<‘-’;} prlvate: intrl; }; intmain(){ Aal; constA a2(4); a1.print(2); a2.print(); returh0; } 运行时的输出结果是()。

A.P8-E4

B.P8-C16-

C.P0-E4-

D.P0-C16-

点击查看答案
第2题
(27 )有如下程序:#includeusing namespace std;class test {private:int a;public:test () {cou

(27 )有如下程序:

#include

using namespace std;

class test {

private:

int a;

public:

test () {cout<< ” constructor ” <<ENDL;}

test (int a ) {cout<<A<<ENDL;}

test (const test & _test )

{

a=_testa;

cout<< ” copy constructor ” <<ENDL;

}

test () {cout<< ” destructor ” <<ENDL;}

};

int main ()

}

test A (3 )

return0;

运行时输出的结果是

A ) 3

B ) constructor

destruclor

C ) copy constructor

dstructor

D ) 3

destruclor

点击查看答案
第3题
有如下程序:#include +using namespace std ;#includeusing namespace std;class Base{publ

有如下程序:

#include +

using namespace std ;

#include

using namespace std;

class Base

{

public:

void fun(){cout<<"Base::fun"<

};

class Derived:public Base

{

public:

void fun()

{

cout<<"Derived::fun"<

}

};

int main()

{

Derived d;

d.fun();

return 0;

}

已知其执行后的输出结果为:

Base::fun

Derived::fun

则程序中下划线处应填入的语句是

A . Base.fun();

B . Base::fun()

C . Base->fun()

D . fun();

点击查看答案
第4题
有如下程序:#includeusing namespace std;class Complex{double re, im;public:Complex(dou

有如下程序:

#include

using namespace std;

class Complex

{

double re, im;

public:

Complex(double r, double i):re(r), im(i){}

double real() const{return re;}

double image() const{return im;}

Complex& operator +=(Complex a)

{

re += a.re;

im += a.im;

return *this;

}

};

ostream &operator<<(ostream& s,const Complex& z)

{

return s<<'('<

}

int main()

{

Complex x(1, -2), y(2, 3);

cout<<(x += y)<

return 0;

}

执行这个程序的输出结果是

A . (1, -2)

B . (2, 3)

C . (3, 5)

D . (3, 1)

点击查看答案
第5题
(15 )下列程序的输出结果是 【 15 】 。#includeusing namespace std;class A {int a;public:A():a

(15 )下列程序的输出结果是 【 15 】 。

#include

using namespace std;

class A {

int a;

public:

A():a(9){}

virtual void print() const { cout<<a;};

};

class B : public A {

char b;

public:

B(){b='S';}

void print() const { cout <<b;}

};

void show(A &x){ x.print();}

int main()

{ A d1,*p;

B d2;

p=&d2;

d1.print();

d2.print();

p->print();

show(d1);

show(d2);

return 0;}

点击查看答案
第6题
有如下程序: A.24B.30C.12D.18

有如下程序:有如下程序: A.24B.30C.12D.18有如下程序: A.24 B.30 C.12D.18请帮

A.24

B.30

C.12

D.18

点击查看答案
第7题
有如下程序:编译运行程序将出现的情况是()。

有如下程序:

有如下程序:编译运行程序将出现的情况是()。有如下程序:  编译运行程序将出现的情况是()。 请帮忙

编译运行程序将出现的情况是()。

有如下程序:编译运行程序将出现的情况是()。有如下程序:  编译运行程序将出现的情况是()。 请帮忙

有如下程序:编译运行程序将出现的情况是()。有如下程序:  编译运行程序将出现的情况是()。 请帮忙

有如下程序:编译运行程序将出现的情况是()。有如下程序:  编译运行程序将出现的情况是()。 请帮忙

有如下程序:编译运行程序将出现的情况是()。有如下程序:  编译运行程序将出现的情况是()。 请帮忙

点击查看答案
第8题
有如下程序: 则b的值是()。 A.15B.16C.18D.19

有如下程序:有如下程序: 则b的值是()。 A.15B.16C.18D.19有如下程序:  则b的值是()。 A则b的值是()。

A.15

B.16

C.18

D.19

点击查看答案
第9题
有如下程序段:MOV31H,#24HMOVA,31H;SWAPAANLA,#0F0H执行结果是()

A.(A)=24H

B.(A)=42H

C.(A)=40H

D.(A)=00H

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改