题目内容 (请给出正确答案)
[主观题]

有如下程序:#include <iostream> using namespace std; class Test{ public: Test(){} ~Te

有如下程序:#include <iostream> using namespace std; class Test{ public: Test(){} ~Test(){cout<<’#’;} }; int main(){ test temp[2], *ptemp[2]; return 0; } 执行这个程序输出星号(#)的个数为()。> A、1

B、2

C、3

D、4

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“有如下程序:#include <iostream> usin…”相关的问题

第1题

有如下程序:

#include<iostream>

usingnamespacestd;

classTest(

public:

Test( ){}

Test(constTest8Lt){cout<<1;}

};

Testfun(Test&u){Testt=U;returnt;}

intmain( ){Testx,y;x=fun(y);return0;}

运行这个程序的输出结果是( )。

A.无输出

B.1

C.1l

D.111

点击查看答案

第2题

( 28 )有如下程序

#include <iostream>

using namespace std;

class Test{

public:

Test(){ }

Test(const Test &t) {cout<<1;}

};

Test fun(Test &u) {Test t=u; return t;}

int main(){Test x,y; x=fun(y); return 0;}

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

A )无输出

B ) 1

C ) 11

D ) 111

点击查看答案

第3题

有如下程序: #include<iostream> usingnamespacestd; classTest { public: Test(){n+=2;} ~Test(){n-=3;} staticintgetNum(){returnn;} private: staticintn; }; intTest::n=1; intmain() { Test*p=neWTest; deletep;

cout<<"n="<<Test::getNum()<<endl; return0; } 执行该程序的输出结果是( )。

A.n=0

B.n=1

C.n=2

D.n=3

点击查看答案

第4题

有如下程序:

#include<iostream>

usingnamespacestd;

classTest

{

public:

Test(){n+=2;}

~Test(){n-=3;}

staticintgetNum(){returnn;}

private:

staticintn;

};

intTest::n=1;

intmain()

{

Test*p=neWTest;

deletep;

cout<<"n="<<Test::getNum()<<endl;

return0;

}

执行该程序的输出结果是( )。

A.n=0

B.n=1

C.n=2

D.n=3

点击查看答案

第5题

有如下程序: #inClude<iostream> using namespaCe std; Class test{ private: int a; publiC: test( ){Cout<<”ConstruCtor”<<endl;} test(int A.{Cout<<a<<endl;} test(Const test&_test){ a=test.a: Cout<<”Copy ConstruCtor”<<endl: } test( ){Cout<<”destruCtor”<<endl;} }; int main( ){ test A(3); return 0; } 执行这个程序的输出结果是( )。

A.3

B.ConstruCtor destruCtor

C.Copy ConstruCtor destruCtor

D.3 destruCtor

点击查看答案

第6题

有如下程序:

#included<iostream>

usingnamespacestd;

classTestClass

{inta;

pubIic:

TestClass(intx){a=x;}

voidshow(){cout<<a;)};

classTestClassl:publicTestClass

{intb;

public:

TestClassl(inti):TestClass(i+1),b(i){}

voidshow(){cout<<b;)};

intmain()

{TestClassb(5),*P;

TestClassld(1):

p=&d;

p->show();

return0;}

该程序运行后的打印结果是( )。

A.5

B.1

C.0

D.2

点击查看答案

第7题

有如下程序: #included<iostream> usingnamespacestd; classTestClass { private: intx,Y; public: TestClass(inti,intj) { x=i: y=j; } voidprint() { cout<<"printl"<<endl; } voidprint()const { cout<<"print2"<<endl; } }; intmain() { constTestClassa(1,2); print(); return0; } 该程序运行后的输出结果是( )。

A.printl

B.print2

C.printlprint2

D.程序编译时出错

点击查看答案

第8题

有如下程序: #included<iostream> usingnamespacestd; classTestClass {private: intX,y; public: TestClass(inti,intj) {x=i; y=j;} voidprint() {cout<<"printl"<<endl;} voidprint()const {cout<<"print2"<<endl;}}; intmain() {constTestClassa(1,2); print(); return0;} 该程序运行后的输出结果是( )。

A.printl

B.print2

C.printlprint2

D.程序编译时出错

点击查看答案

第9题

有如下程序:

#included<iostream>

usingnamespacestd;

classTestClass

{private:

intX,y;

public:

TestClass(inti,intj)

{x=i;

y=j;}

voidprint()

{cout<<"printl"<<endl;}

voidprint()const

{cout<<"print2"<<endl;}};

intmain()

{constTestClassa(1,2);

print();

return0;}

该程序运行后的输出结果是( )。

A.printl

B.print2

C.printlprint2

D.程序编译时出错

点击查看答案

第10题

有如下程序:#include <iostream>using namespace std:class Test{public: Test() {n+=2; ~Test() {n-=3; ; static int getNum() {return n;}privaue: static int n:};int Test::n=1;int main(){ Test* p=new Test; delete p; cout<<"n="<<Test::getNum()<<end1; return 0;} 执行后的输出结果是

A.n=0

B.n=1

C.n=2

D.n=3

点击查看答案
热门考试 全部 >
相关试卷 全部 >
账号:
你好,尊敬的上学吧用户
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,
如果您知道正确答案,欢迎您来纠错

警告:系统检测到您的账号存在安全风险

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

微信搜一搜
上学吧
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
上学吧
点击打开微信