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

有如下程序:#include<iostream>using namespace std;class AA{int k:protected:int n;void

有如下程序:

#include<iostream>

using namespace std;

class AA{

int k:

protected:

int n;

void setK(int k){mis->k=k;}.

public:

void setN(int n){tllis->n=n;}

};

class BB:public AA{/*类体略*/};

int main(){

BB X;

x.n=l: //1

x.setN(2); //2

x.k=3: ///3

X.setK(4); //4

return 0;

}

在标注号码的4条语句中正确的是

A.1

B.2

C.3

D.4

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

有如下程序:

#include

#include

using namespace std;

int main()

{

cout.fill('*');

cout<

return 0;

}

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

A . 123*OK

B . 123*OK**

C . *123OK

D . *123**OK

点击查看答案
第2题
(10 )有如下程序:#include<iostream>using namespace std;class A{public:A(){cout<&l

(10 )有如下程序:

#include<iostream>

using namespace std;

class A{

public:

A(){cout<<"A" ; }

~A(){cout<<"A" ; }

} ;

class B {

A a;

public:

B(){cout<<"B";}

~B(){cout<<"B";}

};

int main (){

B b;

return 0;

}

程序的输出结果是 ___________

点击查看答案
第3题
有如下程序:#include<iostream>using namespace std;int main(){cout.fill('*');cout.width(6);c

有如下程序: #include<iostream> using namespace std; int main() { cout.fill('*'); cout.width(6); cout.fill('#'); cout<<888<<end1; return 0; } 的执行结果是()。

A.###888

B.888###

C. ***888

D.888***

点击查看答案
第4题
有如下程序:#include<iostream>using namespace std;int main(){cout.fill('*');cout.width(5);c

有如下程序: #include<iostream> using namespace std; int main() { cout.fill('*'); cout.width(5); cout<<scientific<<314.15926535<<endl; return 0; } 程序运行后,输出的结果是()。

A.3.141593e+002

B.3.1416e+002

C.**3.14e+002

D.314.16

点击查看答案
第5题
?有如下程序:include(iostream.h>include<stdlib.h>classTestClass{public:intX,y;Test

?有如下程序:

include(iostream.h>

include<stdlib.h>

classTestClass

{

public:

intX,y;

TestClass(){x=y=0;}

TestClass(inta,intb){x=a;y=b;}

voiddisp()

{

cout<<"x="<<x<<",y="<y<<endl;

}

};

voidmain()

{

TestClasss1(2,3);

s1.disp();

}

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

A.100

B.000

C.010

D.001

点击查看答案
第6题
有如下程序:#include<iostream>#include<iomanip>using namespace std;int main(){c

有如下程序:

#include<iostream>

#include<iomanip>

using namespace std;

int main(){

cout<<setw(10)<<setfill(’X’)<<setprecision(8)<<left;

cout<<12.3456793<<______<<98765;

return 0;

}

若程序的输出是12.345679x98765xxxxx,则划线处缺失的部分是

A.setw(10)

B.setfill(’X’)

C.setprecision(8)

D.right

点击查看答案
第7题
有如下程序:#include<iostream>using namespace std;Class TestClass{int a;public:TestClass(in

有如下程序: #include<iostream> using namespace std; Class TestClass {int a; public: TestClass(int x){a=x;} void show(){cout<<a;}}; class TestClass1:public TestClass {int b; public: TestClass1(int i):TestClass(i+1),b(i){} voi

A.5

B.1

C.0

D.2

点击查看答案
第8题
有如下程序: #include<iostream> usingnamespacestd; classC1{ public: ~C1(){cout&l
有如下程序: #include<iostream> usingnamespacestd; classC1{ public: ~C1(){cout<<1;) }; classC2:publicC1{ public: ~C2(){cout<<2;) }; intmain(){ C2cb2; C1*cb1: return0; } 运行时的输出结果是()。

A.121

B.21

C.211

D.12

点击查看答案
第9题
有如下程序: #include<iostream> usingnamespacestd; classVAC{ public; intf()const(r

有如下程序: #include<iostream> usingnamespacestd; classVAC{ public; intf()const(return3;} intf(){return5;} }; Intmain(){ VACv1:

constVACv2; cout<<v1.f()<<v2.f(); return0; } 运行时的输出结果是()。

A.53

B.35

C.55

D.33

点击查看答案
第10题
有如下程序:#include<iostream>using namespace std;int main(){ cout.fill('*'); cout.width(5)

有如下程序: #include<iostream> using namespace std; int main() { cout.fill('*'); cout.width(5); cout<<scientific<<315926535<<endl; retrun 0; } 程序运行后,输出的结果是()。

A.3.14E+02

B.3.14E+02

C.**3.14e+002

D.314.16

点击查看答案
第11题
有如下的程序: include <iostream> include <fstream> using namespace std; int main() { ofstr

有如下的程序:

include <iostream>

include <fstream>

using namespace std;

int main()

{

ofstream outf("D:\\temp.txt",ios_base::trunc) ;

outf<<"World Wide Web";

outf.close();

ifstream inf("D:\\temp.txt");

char s[20];

inf>>s;

inf.close();

cout<<s;

return 0;

}

执行后的输出结果是【 】。

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