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

有如下程序: include <iostream> using namespace std; int strle(char a[],char b[]) {int num=

有如下程序:

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,则程序的输出结果是【 】。

提问人:网友hejun_7777 发布时间:2022-01-07
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“有如下程序: include <iostream> usin…”相关的问题
第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题
在下面的程序的横线处填上适当的语句,使该程序的输出为12。

include<iostream.h>

using namespace std;

class Base

{

public:

int a,b;

Base(int i){a=i;}

};

class Derived:public Base

{

int a;

public:

Derived(int x):Base(x),b(x+1){};

void show()

{

______;//输出基类数据成员a的值

cout<<b<<endl;

}

};

int main()

{

Derived d(1);

d.show();

return 0;

点击查看答案
第9题
有如下类定义,请将Sample类的复制构造函数补充完整。

class Sample{

public:

Sample(){ }

~Sample(){if(P)delete P;)

Sample(const Sample&s){______}

void SetData(int datA) {P=new int(datA) ;}

private:

int*P:

};

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

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

简答题官方微信公众号

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

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

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