题目内容 (请给出正确答案)
[单选题]

执行下列C++语句:double x = 0; if (x ) cout << 1 / x; else cout << x; 显示器上将显示()。

A.0

B.∞

C.显示错误信息

D.什么都没显示

提问人:网友sitpretty 发布时间:2022-01-06
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
网友答案
查看全部
  • · 有4位网友选择 A,占比44.44%
  • · 有2位网友选择 B,占比22.22%
  • · 有2位网友选择 D,占比22.22%
  • · 有1位网友选择 C,占比11.11%
匿名网友 选择了B
[147.***.***.69] 1天前
匿名网友 选择了C
[250.***.***.228] 1天前
匿名网友 选择了B
[147.***.***.69] 1天前
匿名网友 选择了B
[216.***.***.4] 1天前
匿名网友 选择了C
[250.***.***.228] 1天前
匿名网友 选择了D
[165.***.***.191] 1天前
匿名网友 选择了A
[54.***.***.155] 1天前
匿名网友 选择了A
[231.***.***.30] 1天前
匿名网友 选择了D
[229.***.***.20] 1天前
匿名网友 选择了A
[122.***.***.204] 1天前
匿名网友 选择了A
[242.***.***.41] 1天前
匿名网友 选择了B
[216.***.***.4] 1天前
匿名网友 选择了B
[216.***.***.4] 1天前
匿名网友 选择了C
[250.***.***.228] 1天前
匿名网友 选择了D
[165.***.***.191] 1天前
匿名网友 选择了A
[54.***.***.155] 1天前
匿名网友 选择了A
[231.***.***.30] 1天前
匿名网友 选择了D
[229.***.***.20] 1天前
匿名网友 选择了A
[122.***.***.204] 1天前
匿名网友 选择了A
[242.***.***.41] 1天前
加载更多
提交我的答案
登录提交答案,可赢取奖励机会。
更多“执行下列C++语句:double x = 0; if (x …”相关的问题
第1题
1)#include 2)# include 3)using namespace std;4)dou...

1)#include< iostream >

2)# include< math.h >

3)using namespace std;

4)double max(double x,doubley);

5)void main()

6){

7)double   a,b,c;

8)cout<< " input two numbers:"; 9)cin>>a>>b;

10)c=max(a,b);

11)cout<< " the squart of max imum="<< sqrt(c); 12)} 13)double max(doublex,doubley) 14){ 15)if(x>y)

16)returnx;

17)else

18)returny;

19)}

若执行第9行时,输入89后按回车,则执行完第10行后,c的值是:()

A. 8

B. 8.0(小数位数由编译器决定)

C. 9

D. 9.0(小数位数由编译器决定)

点击查看答案
第2题
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)}

执行完第13行后,变量a的值是:()

A. 0

B. 1

C. 变量不存在

D. 随机值

点击查看答案
第3题
阅读下列程序说明和C++代码,将应填入(n)处。

【说明】

①在类体中添加函数move(double ax,double ay)的定义,使得点的坐标x和y分别移动 ax和ay个单位。

②在类定义外完成重载的两个构造函数CPosition()和CPosition(double dx,double dy),其中前者为不带参数的构造函数,使CPosition对象的默认值为x=0,y=0,后者为带参数的构造函数,把数据成员x和y分别初始化为参数dx和dy的值。

③完成函数double distance(double bx,double by)的定义,该函数返回*this和点(bx, by)的距离。

注意:除在指定的位置添加语句外,请不要改动程序中的其他语句。

源程序文件test5.cpp清单如下:

include<iostream.h>

include<math.h>

class CPosition

{

public:

CPosition();

CPosition(double dx,double dy);

double getx();

double gety();

(1)

double distance(double bx,double by);

private:

double x;

double y;

};

(2)

{

x=0;y=0;

}

CPosition::CPosition(doub,e dx,doub,e dy)

{

x=dx; y=dy;

}

double CPosition::getx()

{

return x;

}

double CPosition::gety()

{

return y;

}

double CPosition::distance(double bx,double by)

{

(3)

}

vold main()

{

double a,b;

cout<<"|nput x,y position of a point:";

cin >> a >> b;

CPosition psA(a,b);

cout<<"Input x,y position of another point:";

cin >>a >> b;

cout <<"The distance is" <<psA.distance(a,b) <<end1;

}

点击查看答案
第4题
以下程序的输出结果是 。 #include void main() { int a=325; double x=3.1415926; /*下面这句中%和6d之间是没有空格的,为了APP能显示,故意加了空格,请大家注意*/ printf("a=% 6d x=%.4f",a,x); }
点击查看答案
第5题
请编写函数fun,其功能时:计算并输出当x<0.97时下列多项式的值,直到|sn-s(n-1)|<0.000001为止。

Sn=1+0.5x+0.5(0.5-1)/2!x(2)+…+0.5(0.5-1)(0.5-2)…..(0.5-n+1)/n!x(n)

点击查看答案
第6题
执行以下程序输出是: #include<iostream> using namespace std; #define P 5 #define R (P+P) int main(void) { float a1; a1 = P* R * R; cout << "a1="<<a1<<'\n'; return> A、a1=55

B、a1=75

C、a1=250

D、a1=500

点击查看答案
第7题
#include <iostream> using namespace std; class Circle{ private: double radius=1; public: Circle(); Circle(double r){ radius=r; } void display(){ cout<<radius<<endl; } }; int main() { 创建一个radius="5的对象,名字为c1。" c1.display();>
点击查看答案
第8题
选择一下代码的输出结果( ) interface A { public String show(); } class B implements A { public String show() { return "B"; } } class C extends B { public String show() { return "C"; } } public class Test { public static void main(String[] args) { A a = new B(); B b = new C(); A c = new C(); System.out.println(a.show() + b.show() + c.show()); }

A、CBC

B、BCC

C、CCB

D、运行时抛出异常

点击查看答案
第9题
分析以下程序执行结果【 】。

include<iostream.h>

int f (int x, int y){

return x,y;

}

double f (double x, double y) {

return x,y;

}

void main() {

int a=4, b=6;

double c=2.6, d=7.4;

cout<<f (a, b) <<","<<f (c, d) <<end1;

}

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

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

简答题官方微信公众号

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

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

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