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

有如下程序: #inClude<iostream> using namespaCe std; Class MusiC{ publiC: void setT

itle(Char*str){strCpy(title,str);} proteCted: Char type[10]; private: Char title[20]; Class Jazz:publiC MusiC{ publiC: void set(Char*str){ strCpy(type,”Jazz’);//① strCpy(title,str);//② } }; 下列叙述中正确的是()。

A.程序编译正确

B.程序编译时语句①出错

C.程序编译时语句②出错

D.程序编译时语句①和②都出错

提问人:网友snow_1002 发布时间:2022-01-06
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“有如下程序: #inClude<iostream> usin…”相关的问题
第1题
有如下程序: #include using namespace std; class Pair{ int m,n; public: Pair(int j,int k):m(j),n(k){} int get{return m;} int getconst{return m+n;} }; int main{ Pair a(3,5); const Pair b(3,5); tout$amp;A.33

B.38

C.83

D.88

点击查看答案
第2题

有如下程序: #include <iostream.h> using namespace std; class Stack { public: Stack (unsigned n=10):size (n) {rep_=new int [size]; top=0;} Stack (stack&s}: size (s.size) { rep_new int[size]; for (int i=0;i<size;i++ rip_[i]-s.rep_[i]; top=s.top; } ~Stack() {delete[]rep_;} void poush (int a) {rep_[topj=a; top++;} int pep() { --top; return rep_[top];} bool isEmpty() cons5 [return Top ==0;} private: int*rep_; unsigned size, top; }; int main() { Stack s1; for(int i=1;i<5;i++) s1.push(i); Stack s2(s1); for(i=1;i<3;i++} cout<<s2.pop()<<','; s2.push(6); s1.push(7); while(!s2.isEmpty()) cout<<s2.pop()<<','; return 0; } 执行上面程序的输出是

A.4,3,2,1,

B.4,3,6,7,2,1,

C.4,3,6,2,1,

D.1,2,3,4,

点击查看答案
第3题
有如下程序: #include(iostream> usingnamespacestd; classCon { charID; public: Con():ID('A){cout$amp;A.13A23A

B.23A13B

C.13A23B

D.13823A

点击查看答案
第4题
有基类如下: class BASE{ private: int x,y; public: BASE(int x,int y){this->x=x;this->y=y;} void set(int x1,int y1) { x=x1; y=y1; } ... }; 设DERIV为BASE的公有派生类,则下列哪个DERIV的构造函数对基类成员的初始化是正确的?

A、DERIV( int x, int y ) { BASE(x , y) ; ... }

B、DERIV( int x1, int y1 ){ x=x1; y=y1; ... }

C、DERIV( int x, int y ) : BASE( x , y ) { ... }

D、DERIV( int x, int y ) {set(x1,y1); ... }

点击查看答案
第5题
判断下列程序的正确运行结果( ) #include <iostream> using namespace std; class Student{ public: static int count; Student(){cout<<"the"<<++count<<"student is int total(){return count;} ~student(){count--;} }; student::count="0;" main() { student s1,s2; *p1="&amp;s1;">total()<<endl; student *p2="new" student();>total()<<endl; delete p2;>total()<<endl; return 0;> A、3 4 3

B、2 3 2

C、3 3 3

D、3 3 2

点击查看答案
第6题
有如下程序:

#included

usingnamespacestd;

classTestClass

{private:

intX,y;

public:

TestClass(inti,intj)

{x=i;

y=j;}

voidprint()

{cout$amp;voidprint()const

{cout$amp;intmain()

{constTestClassa(1,2);

print();

return0;}

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

A.printl

B.print2

C.printlprint2

D.程序编译时出错

点击查看答案
第7题
程序 #include<iostream> using namespace std; void fun(int &a,int &b) { int p; p=a; a=b; b=p; } void exchange(int &a,int &b,int &c) { if(a<b)fun(a,b); } int main() { a="5,b=9,c=6;" exchange(a,b,c); ,b="&lt;&lt;b&lt;&lt;" ,c="&lt;&lt;c&lt;&lt;endl; return 0;} 程序运行时输出的结果是什么?&lt;br&gt;&lt;p class=" answer">

1、详见附件。 要求按照上机要求,提交实验报告word和程序的压缩包,包括封面、实验目的、实验内容(题目、代码、结果及分析)、实验步骤、实验心得体会、建议。 请同学们按照评分标准进行互评。

点击查看答案
第8题
有以下程序: #include float tun(int X,int Y) {return(X+Y);} void main {int a=2,b=5,c=8; cout$amp;A.编译出错

B.9

C.21

D.9.0

点击查看答案
第9题
以下关键字不能用来声明类的访问权限的是()。

A.publiC

B.statiC

C..proteCted

D.private

点击查看答案
第10题
this指针是C++语言实现()的一种机制。

A.抽象

B.封装

C.继承

D.重载

点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

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

简答题官方微信公众号

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

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

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