搜题
网友您好,请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
提问人:网友tmwlnjtu 发布时间:2022-01-07
[主观题]

有如下程序: include<iostream> using namespaee std;class Animal{ public: virtual char*g

有如下程序:

include<iostream>

using namespaee std;c lass Animal{

public:

virtual char*getType()const{return"Animal";}

virtual char*getVoice()const{return"Voice";}

};

class Dog:public Animal{

public:

char*getType()const{return"Dog";}

char*getVoice()eonst{return"Woof";}

};

void type(Animal&A) {cout<<a.getType();}

void speak(Animal A) {eout<<a.getVoice();}

int main(){

Dog d;type(D) ;cout<<"speak";speak(D) ;cout< return 0;

}

程序的输出结果是______。

简答题官方参考答案 (由简答题聘请的专业题库老师提供的解答)
查看官方参考答案
更多“有如下程序: include<iostream> using namespaee std;class Animal{ public: virtual char*g”相关的问题
第1题
有如下程序,请问其输出是____。 class Base { //基类 public: Base() { cout << "1" ; } ~Base() { } }; class Derived : public Base { //派生类 public: Derived() { Base(); cout << "3"; } ~Derived() { } }; int main(int argc, char* argv[]) { Derived od; return 0; }
点击查看答案
第2题
有如下程序:

#include

voidmain()

{charch[2][5]={"6937","8254"),*p[2];

inti,j,s=0;

for(i=0;i<2;i++)p[i]=ch[i];

for(i=0;i<2;i++)

for(j=0;p[i][j]$amp;>apos;$\0';j+=2)

s=10*s+p[i][j]-'0';

cout$amp;该程序的输出结果是()。

A.69825

B.63825

C.6385

D.693825

点击查看答案
第3题
若有如下程序: int sub(int m) { if(m==1||m==0) return 2; else return(sub(m-1)*sub(m-2));} main() { int n; scanf("%d",&n); printf("%d",sub(n)); } 如果从键盘输入4<回车>,则程序运行后的输出结果是()。

A.8

B.16

C.24

D.32

点击查看答案
第4题
有如下程序: #include<iostream> 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<<'('<<z.real()<<','<<z.image()<<')'; } int main() { Complex x(1,2),y(2,3); tout<<(x+=y)<<endl; return 0; } 执行这个程序的输出结果是()。

A.(1,-2)

B.(2,3)

C.(3,5)

D.(3,1)

点击查看答案
第5题
1)#include 2)#include 3)using namespace std;4)doub...

1)#include< iostream >

2)#include< cmath >

3)using namespace std;

4)double max(double x,doubley)

5){

6)if(x>y)

7)return x;

8)else

9)return y;

10)}

11)int main()

12){

13)doublea,b,c;

14)cout<<" input two numbers:"; 15)cin >>a >>b;

16)c=max(a,b);

17)cout<<" the squart of max imum="<< sqrt( c ); 18)}

执行完第14行后,命令提示符窗口中输出的结果是:()

点击查看答案
第6题
有如下程序:#include <iostream> using namespace std; class ONE { int c; public: ONE(): c(0) { cout<<1; } one(int n): c(n) { }; two one onel; one2; public: two(int m) : one2(m) int main() t(4); return 0; 运行时的输出结果是( )> A、3

B、23

C、123

D、213

点击查看答案
第7题
有如下程序: #include<iostream> using namespace std; class Base { public: void funl(){cout<<"Basea";} virtual void fun2(){tout<<"Base\n";} }; class Derived:public Base { public: void funl() {cout<<"Derived\n"; } void fun2() {cout<<"Derived\n"; } }; void f(Base& b) {b.funl(); b.fun2(); } int main() { Derived obj; f(obj); return 0; } 执行这个程序的输出结果是

A.Base Base

B.Base Derived

C.Derived Base

D.Derived Derived

点击查看答案
第8题
以下程序中的select()函数功能是:在N行M列的二维数组中选出一个最大值作为函数值返回,并通过形参传回此最大值的行下标。请填空完成此程序。

include<iostream>

define N 3

define M 3

using namespace std;

int select(int a[N][M],int *n)

{

int i,j,row=0,colum=0;

for(i=0;i<N;i++)

for(i=0;j<M;j++)

if(a[i][j]>a[row][colum])

{

row=i;

colum=j;

}

*n=【 】;

return 【 】;

}

int main()

{

int a[N][M]={9,11,23,6,1,15,9,17,20};

int max,n;

max=select(a,&n);

cout<<"max="<<max<<"line="<<n<<end1;

return 0;

}

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

include <iostream>

using namespace std;

int strle(char a[],char b[])

{

int num=O,n=O;

while (* (a+num) !='\0')

num++;

while (b [n] )

{

* (a+num)=b [n];

num++;

n++;

}

return(num);

}

int main ()

{

char strl[80],str2[80],*p1=str1,*p2=str2;

cin>>p1;

cin>>p2;

cout<<strle(p1,p2)<<end1;

return 0;

}

运行上述程序,如果从键盘输入字符串qwerty和字符串abcd,则程序的输出结果是【 】。

点击查看答案
重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

功能 扣减规则
基础费
(查看答案)
加收费
(AI功能)
文字搜题、查看答案 1/每题 0/每次
语音搜题、查看答案 1/每题 2/每次
单题拍照识别、查看答案 1/每题 2/每次
整页拍照识别、查看答案 1/每题 5/每次

备注:网站、APP、小程序均支持文字搜题、查看答案;语音搜题、单题拍照识别、整页拍照识别仅APP、小程序支持。

2. 使用语音搜索、拍照搜索等AI功能需安装APP(或打开微信小程序)。

3. 搜题卡过期将作废,不支持退款,请在有效期内使用完毕。

请使用微信扫码支付(元)

订单号:

遇到问题请联系在线客服

请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示:请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
警告:系统检测到您的账号存在安全风险

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

- 微信扫码关注简答题 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注简答题 -
请用微信扫码测试
欢迎分享答案

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

简答题官方微信公众号

简答题
下载APP
关注公众号
TOP