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

(35 )有如下程序::#includeusing namespace std:class Sample{friend long fun (Sample s ) ;p

(35 )有如下程序::

#include

using namespace std:

class Sample

{

friend long fun (Sample s ) ;

public:

Sample (long a ) {x=a;}

Private:

long x;

};

long fun (Sample s )

{

if (s.x<2 ) retum 1;

retum s.x*fun (Sample (s.x-a ))

}

int main ()

{

int sum=0

for (int i =0; i <6; i ++ ) { sum+=fun (Sample (i ) ; ) }

cout<<SUM;

retum 0;

}

运行时输出的结果是

A ) 120

B ) 16

C ) 154

D ) 34

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“(35 )有如下程序::#includeusing name…”相关的问题

第1题

有如下程序: #include using namespace std; class VAC{ public; int f() const { return 3

A. 53

B. 35

C. 55

D. 33

点击查看答案

第2题

(35 )有如下程序 ;#include<iostream>using namespace std;class B{public:virtual void

(35 )有如下程序 ;

#include<iostream>

using namespace std;

class B{

public:

virtual void show(){cout<<"B";}

};

class D:public B{

public:

void show() {cout<<"D";}

};

void fun1(B *ptr){ptr->show();}

void fun2(B &ref){ref.show();}

void fun3(B b){b.show();}

int main(){

B b,*p=new D;

D d;

fun1(p);

fun2(b);

fun3(d);

return 0;

}

程序的输出结果是

A ) BBB

B ) BBD

C ) DBB

D ) DBD

点击查看答案

第3题

(35 )有如下程序:#include<iostream>using namespace std;class ONE{int c;public:ONE (

(35 )有如下程序:

#include<iostream>

using namespace std;

class ONE{

int c;

public:

ONE () : c (0 ) {cout<<1;}

ONE (int n ) : c (n ) {cout<<2;}

};

class TWO{

ONE onel;

ONE one2;

public:

TWO (int m ) : one2 (m ) {cout<<3;}

};

int main () t

TWO t (4 )

return 0

}

运行时的输出结果是

A ) 3

B ) 23

C ) 123

D ) 213

点击查看答案

第4题

(35 ) 有如下程序#includeusing namespace std;class A{public:virtual void func1(){ cout<

(35 ) 有如下程序

#include

using namespace std;

class A{

public:

virtual void func1(){ cout<<"A1"; }

void func2(){ cout<<"A2"; }

};

class B:public A{

public:

void func1(){ cout<<"B1"; }

void func2(){ cout<<"B2"; }

};

int main(){

A *p=new B;

p->func1();

p->func2();

return 0;

}

运行此程序 , 屏幕上将显示输出

A) B1B2

B) A1A2

C) B1A2

D) A1B2

点击查看答案

第5题

(35 )有如下程序:#include <iostream>using namespace std;Class B{public:B(int xx):x(x

(35 )有如下程序:

#include <iostream>

using namespace std;

Class B{

public:

B(int xx):x(xx) {++cout; x+=10;}

virtual void show() const

{cout<<count<< ' _ ' <<x<<endl;}

protected:

static int count;

private:

int x;

};

class D:public B{

public:

D(int xx,int yy):B(xx),y(yy) {++count; y+=100;}

virtual void show() const

{cout<<count<< ' _ ' <<y<<endl;}

private:

int y;

};

int B::count=0;

int main(){

B *ptr=new D(10,20);

ptr->show();

delete ptr;

return 0;

}

运行时的输出结果是

A ) 1_120

B ) 2_120

C ) 1_20

D ) 2_20

点击查看答案

第6题

有以下程序: #include <stdio.h> main() {intc = 35; printf("% d \n" , e&c); }程序运行

有以下程序: #include <stdio.h> main() { intc = 35; printf("% d \n" , e&c); } 程序运行后输出结果是()。

A.0

B.70

C.35

D.1

点击查看答案

第7题

现有如下程序段,此程序段编译有错误,则程序段的错误出在include<stdio.h>main()这个语句
点击查看答案

第8题

有如下程序 #include<iostream> #include<iomanip> using namespace std; int main(

有如下程序 #include<iostream> #include<iomanip> using namespace std; int main(){ cout<<setprecision(3)<<fixed<<setfill('*')<<setw(8); cout<<12.345<<_______<<34.567; return 0; } 若程序的输出是: ** 12.345**34.567 则程序中下划线处遗漏的操作符是

A.setprecision(3)

B.fixed

C.setfill('*')

D.setw(8)

点击查看答案

第9题

现有如下程序段,此程序段编译有错误,则程序段的错误出在 include main()这个语句
点击查看答案

第10题

有如下程序: #include<iostream> using namespace std; int main() { cout.f

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

A.###123

B.123###

C.***123

D.123***

点击查看答案
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
温馨提示
每个试题只能免费做一次,如需多次做题,请购买搜题卡
立即购买
稍后再说
警告:系统检测到您的账号存在安全风险

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

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