当前位置: 答题翼 > 问答 > 计算机类考试 > 正文
目录: 标题| 题干| 答案| 搜索| 相关
问题

与y=(x>0? 1:x0)y=1 else if(x


与y=(x>0? 1:x<0? -1:0);的功能相同的if语句是

A.if(x>0)y=1 else if(x<0)y=-1; else y=O;

B.if(x) if(x>0)y=1; else if(x<0)y=-1;

C.y=-1; if(x) if(x>0)y=1; else if(x==0)y=0; else y=-1;

D.y=0; if(x>=0) if(x>0)y=1; else y=-1;

请帮忙给出正确答案和分析,谢谢!

参考答案
您可能感兴趣的试题
  • (27)有以下程序#include <stdio.h>main(){ int x=1,y=0;if(!x) y++;else if(x==0)if (x) y

  • 有如下程序main( ){ float x=2.0 y;if(x<0.0) y=0.0;else if(x<10.0) y=1.0/x;else y=1.0;pr

  • 与“y=(x>0?1:x<0?1:0)”;的功能相同的if 语句是( )。A.if(x>0)y=1; else if(x<0)y=1;

  • 下列程序段的执行结果为 X=5 Y=-20 If Not X>0 Then X=Y-3Else Y=X+3 Print X-Y;A.-3B.5C.3D.

  • publicclassTest{2.publicTfindLarger(Tx Ty){3.if(x.compareTo(y)>0){4.returnx;5.}else{6

  • 与y=(x>0?1:x0)y=1; else if(x