重要提示: 请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
找答案首页 > 全部分类 > 求职面试
搜题
网友您好, 请在下方输入框内输入要搜索的题目:
搜题
题目内容 (请给出正确答案)
[主观题]

若有以下程序 #include ...

若有以下程序 #include <stdio.h> int f(int a[], int n) { if (n > 1) { int t; t=f(a, n-1); return t > a[n-1] ? t : a[n-1]; } else return a[0]; } main() { int a[] = {8,2,9,1,3,6,4,7,5}; printf("%d\n", f(a, 9)); } 则程序的输出结果是()

A、9

B、1

C、8

D、5

查看答案
更多“若有以下程序 #include ...”相关的问题

第1题

若有以下程序:

include <iostream>

using namespace std;

class sample

{

int x;

public:

sample(){}

void setx(int i)

{

x=i;

}

friend iht fun(sample B[],int n)

{

int m=0;

for{int i=0;i<n;i++)

if(B[i].x>m)

m=B[i].x;

return.m;

}

};

int main ( )

{

sample A[10];

int arr[]={90,87,42,78,97,84,60,55,78,65};

for(int i=O;i<10;i++)

A[i].setx(arr[i]);

cout<<fun(A, 10)<<end1;

return 0;

}

该程序运行后的输出结果是【 】。

点击查看答案

第2题

若有以下程序: #include <iostream> using namespace std; class Base { public: Base ( ) { x=0; } int x; }; class Derivedl : virtual public Base { public: Derivedl () { x=10; } }; class Derived2 : virtual public Base { public: Derived2 () { x=20; } }; class Derived : public Derivedl,protected Derived2{ }; int main ( ) { Derived obj; cout<<obj .x<<end1; return 0; } 该程序运行后的输出结果是 ( )。

A.20

B.30

C.10

D.0

点击查看答案

第3题

若有以下程序: #include <iostream> using namespace Std; class sample { int i; publiC: sample(){} void setvalue(int m) { i=m; } void fun(int m) { i+=m; } void disp() { cout<<i<<end1; } }; int main() { sample *ps; ps=new sample; ps->setvalue(20); ps->fun(5); ps->disp(); return 0; } 程序运行后,输出的结果是( )。

A.15

B.20

C.25

D.30

点击查看答案

第4题

若有以下程序: #include <iostream> using namespace std; int f() { static int i = 0; int s = 1; s+=i; i++; return s; } int main ( ) { int i,a = 0; for(i = 0;i<5;i++) a+=f ( ); cout

A.20

B.24

C.25

D.15

点击查看答案

第5题

若有以下程序:

include <iostream>

using namespace std;

template <class T>

T min(T x,T y)

{

if(x<y)

return x;

else

return y;

}

int main()

{

int n1=2,n2=10;

double d1=1.5;d2=5.6;

cout<<min(n1,n2)<<",";

cout<<min(d2,d2)<<end1;

return 0;

}

程序运行后的输出结果是【 】。

点击查看答案

第6题

若有以下程序:

include<iostream>

using namespace std;

class TestClass 1

{

public:

TestClass1()

{

X=0;

}

int x;

};

class TestClass2:virtual public TestClass1

{

public:

TestClass2()

{

x=10;

}

};

class TestClass3:virtual public TestClass 1

{

public:

TestClass3()

{

x=20;

}

};

class TestClass4:public TestClass2, protected TestClass3

{ };

int main()

{

TestClass4 obj;

cout<<obj.x<<end1;

return 0:

}

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

点击查看答案

第7题

若有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int B) { x=a; y=b; } int getx() { return x; } int gety() { reurn y; } }; class Circle: public Point { private: int r; public: Circle(int a,int b.int C) :Point(a,B) r=c; int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle cl(5,7,10); cout<<c 1 .area()<<end1; return 0; } 程序执行后的输出结果是

A.314

B.157

C.78.5

D.153.86

点击查看答案

第8题

若有以下程序:# include <iostream>using namespace std;class Base{public: Base ( ) { x=0; } int x;};class Derived1 : virtual public Base{public: Derived1 ( ) { x=10; }}; class Derived2 : virtual public Base{public: Derived2 () { x=20; }};class Derived : public Derived1,protected Derived2{ };int main(){ Derived obj; cout<<obj.x<<end1; return 0;} 该程序运行后的输出结果是

A.10

B.20

C.30

D.0

点击查看答案

第9题

若有以下程序: #include <iostream> using namespace std; class point { private: int x, y; public: point ( ) { x=0; y=0; } void setpoint(int x1,int y1) { x=x1; y=y1;

A.12,12

B.5,5

C.12,5

D.5,12

点击查看答案

第10题

若有以下程序: #include <iostream> using namespace std; class Base { private: int x; protected: int y; public: int z; void setx(int i) { x=i; int getx () { return x; } }

A.1,2,3,4

B.产生语法错误

C.4,3,2,1

D.2,3,4,5

点击查看答案
下载上学吧APP
客服
TOP
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案
购买前请仔细阅读《购买须知》
请选择支付方式
微信支付
支付宝支付
选择优惠券
优惠券
请选择
点击支付即表示你同意并接受《服务协议》《购买须知》
立即支付
搜题卡使用说明

1. 搜题次数扣减规则:

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

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

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

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

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

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

- 微信扫码关注上学吧 -
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
- 微信扫码关注上学吧 -
请用微信扫码测试
选择优惠券
确认选择
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,如果您知道正确答案,欢迎您来纠错

上学吧找答案