首页 > 建设工程> 房地产经纪人
题目内容 (请给出正确答案)
[主观题]

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

有如下程序: #include<iostream> using namespace std; class BASE{ public: ~BASE(){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED(){cout<<"DERIVED";} }; int main(){DERIVED x;return 0;} 执行后的输出结果是()。

A.BASE

B.DERIVED

C.BASEDERIVED

D.DERIVEDBASE

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

有如下程序: #include<iostream> using namespace std; Class A { public: A(){cout<<“A”;} ~A(){cout<<“~A”;} }; A*p; public: B(){cout<<“B”;p=new A;} ~B(){cout<<“~B”;delete p;} }; B obj; return 0; ) 执行这个程序的输出结果是(

A.BAA~A~B~A

B.ABA~B~A~A

C.BAA~B~A~A

D.ABA~A~B~A

点击查看答案
第2题
有如下程序:#include<stdio.h>main(){int a=2,b= -1,c=2; if(a<b) if(b<0)c=0; elsec++; printf(

有如下程序: #include <stdio.h> main() { int a=2,b= -1,c=2; if(a<b) if(b<0) c=0; else c++; printf("%d\n",c); } 该程序的输出结果是

A.0

B.1

C.2

D.3

点击查看答案
第3题
有如下程序: #include<iostream>usingnamespacestd; classPair{intm,n; public; Pair(intj

有如下程序:

#include<iostream>

usingnamespacestd;

classPair{

intm,n;

public;

Pair(intj,intk):m(j),n(k){}

intget(){returnm;}

intget()const{returnm+n;}

};

intmain(){

Paira(3,5);

constPairb(3,5);

cout<<a.get()<<b.get();

return0;

}

运行时的输出结果是()。

A.33

B.38

C.83

D.88

点击查看答案
第4题
有如下程序:#include(iostream>using namespace std;Class Test{public:Test(){n+=2;}~Test(){n-

有如下程序: #include(iostream> using namespace std; Class Test { public: Test() {n+=2;} ~Test() {n-=3;) static int getNum() {return n;} private: static int n; }; int Test::n=1; int main() { Test*p=new Test;

A.n=0

B.n=1

C.n=2

D.n=3

点击查看答案
第5题
有如下程序:#include<iostream>using namespace std;class B{public:Virtual void show(){cout<<

有如下程序: #include<iostream> using namespace std; class B{ public: Virtual void show(){cout<<“B”;} }; class D:publicB{ public: void show(){cout<<“D”;} }; void funl(B*ptr){ptr->show();} void{un2(B&ref){ref.show();} void

A.BBB

B.BBD

C.DBB

D.DBD

点击查看答案
第6题
有如下程序:#include<stdio.h>long fib(int n){if(n>2)return(fib(n-1)+fib(n-2)); else return(

有如下程序: #include <stdio.h> long fib(int n) { if(n>2)return(fib(n-1)+fib(n-2)); else return(2); } main() { printf("%d\n",fib(3));} 该程序的输出结果是()。

A.2

B.4

C.6

D.8

点击查看答案
第7题
有如下程序: #include<iostream>usingnamespacestd; classTest{public: Test(){n+=2;}~Tes

有如下程序:

#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

点击查看答案
第8题
有如下程序 #include<iostream.h> #define N2 #define M N+1 #define NUM 2*M+1 void main() { int i; for(i=1,i<= NUM;i++) cout<<i;} 该程序中的for循环执行的次数是

A.5

B.6

C.7

D.8

点击查看答案
第9题
有如下程序: #include<iostream> usingnamespacestd; voidf1(int&X,int&y){intz=X;x=y;y

有如下程序: #include<iostream> usingnamespacestd; voidf1(int&X,int&y){intz=X;x=y;y=z} voidf2(intX,inty){intz=x;x=y;y=z} intmain(){ intx=10,y=26 f1(x,y); f2(X,y); cout<<y<<endl; return0; } 运行时的输出结果是()。

A.10

B.16

C.26

D.36

点击查看答案
第10题
有如下程序:#include<iostream>using namespace std;class Test{public:Test(){n+=2;}~Test(){n-

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

A.n=0

B.n=1

C.n=2

D.n=3

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