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

下列程序的输出结果是________。#include <iostream> using namespace std; void fun(int a,int b) { int m; if(a <b) { m="(a+b)/2;"

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“下列程序的输出结果是________。#include <i…”相关的问题

第1题

给出下面程序的输出结果。

include<iostream>

using namespace std;

void main()

{

int num=0,i=8;

do

{

i--;

num++;

}while(--i);

cout<<num<<endl;

}

点击查看答案

第2题

下列程序的运行结果是 。 #include <iostream> using namespace std; void main() { int ar
下列程序的运行结果是 。 #include <iostream> using namespace std; void main() { int arr[10], i, k=0; for( i=0; i<10; i++) arr[i]="i;" for( i="1;" k+="arr[i]+i;"> < <endl;>

点击查看答案

第3题

下列程序的运行结果是 。 #include <iostream> using namespace std; void main() { int i,
下列程序的运行结果是 。 #include <iostream> using namespace std; void main() { int i, j, y=122, a[8]; for( i=0; y; i++) { a[i]=y%8; y=y/8; } for( j=i-1; j>=0; j--) cout< <a[j]; endl; “y="”&lt;&lt;y&lt;&lt;endl;">

点击查看答案

第4题

有如下程序: #include<iostream> using namespace std; class Base { public: void funl{cout<<”Base\n”;} virtual void fun2{eout<<”Base\n”;} }; class Derived:public Base{ public: void funl{eout<<”Derived、n”;} void fura{eout<.<”Derived\n”;} }; void f(Base&B.}b.funl;b.ftm2;} int main { Derived obj; f(obj); return 0; } 执行这个程序的输出结果是( )。

A.Base Base

B.Base Derived

C.Derived Base

D.Derived Derived

点击查看答案

第5题

有如下程序: #include<iostream> using namespace std; class Base { private: void funlconst{tout<<”funl”;} protected: void fun2const{tout<<”fun2”;} public: void fun3const{cout<<”fhll3”;} }; class Derived:protected Base { public: void fhn4const{cout<<”filn4”;} }; int main { Derived obj; obj.funl;//① obj.fun2;//② obj.furd;//③ obj.fun4;//④ return U: } 其中有语法错误的语句是( )。

A.①②③④

B.①②③

C.②③④

D.①④

点击查看答案

第6题

有如下程序: #include<iostream> usingnamespacestd; voidfunction2(intn); voidfunctionl(intn):{ if(n<=0)return; function2(n-2); } voidfunction2(intn){ if(n<=O)return; functionl(n-1); } intmain(){ functionl(5); return0; } 下列关于程序运行情况的描述中,正确的是( )。

A.functionl运行1次,function2运行2次

B.functionl运行2次,function2运行l次

C.functionl运行2次,function2运行3次

D.functionl运行2次,function2运行2次

点击查看答案

第7题

有如下程序: #inClude<iostream> using namespaCe std; Class MusiC{ publiC: void setTitle(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.程序编译时语句①和②都出错

点击查看答案

第8题

有如下程序: #inClude<iostream> using namespaCe std; Class Base{ publiC: void output{Cout<<1;} virtual void Print{Cout<<B’;} }; Class Derived:publiC Base{ publiC: void output{Cout<<2;} void Print{Cout<<’D ;} }; int main { Base * ptr=new Derived; ptr一>output; ptr一>Print; delete ptr; retum0; } 执行这个程序的输出结果是( )。

A.1B

B.lD

C.2B

D.2D

点击查看答案

第9题

( 32 )有如下程序;

#include<iostream>

using namespace std;

class Base{

public:

void output(){cout<<1;}

virtual void Print(){cout<<'B';}

};

class Derived:public Base{

public:

void output(){cout<<2;}

void Print(){cout<<'D';}

};

int main(){

Base *ptr=new Derived;

ptr->output();

ptr->Print();

delete ptr;

return 0;

}

程序的输出结果是

A ) 1B

B ) 1D

C ) 2B

D ) 2D

点击查看答案

第10题

有如下程序: #inClude<iostream> using namespaCe std; Class B{ publiC: virtual void show{Cout<<”B”;} }; Class D:publiC B{ . publiC: void show{Cout<<”D”;} }; void funl(B * ptr){ptr一>show;} void fUN2(B&ref){ref.show;} voidfhIl3(B B.{b.show;} int main { B b,* P=new D; D d; funl(P); fun2(B.; fun3(D); delete P; return 0; } 执行这个程序的输出结果是( )。

A.BBB

B.BBD

C.DBB

D.DBD

点击查看答案
热门考试 全部 >
相关试卷 全部 >
账号:
你好,尊敬的上学吧用户
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
谢谢您的反馈

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

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

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

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