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

阅读程序:main(){int x;scanf("%d',& x);if (x- -<5)printf("%d\n",x);else printf("%d\、n"

阅读程序: main() {int x; scanf("%d',& x); if (x- -<5)printf("%d\n",x); else printf("%d\、n",x+ +); } 程序运行后,如果从键盘上输入5,则输出结果是 ()

A.3

B.4

C.5

D.6

提问人:网友nian328 发布时间:2022-01-06
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“阅读程序:main(){int x;scanf("%d',&…”相关的问题
第1题
阅读程序,给出程序的执行结果: #include <stdio.h> void count(int n); main() { int i;

阅读程序,给出程序的执行结果: #include <stdio.h> void count(int n); main() { int i; for(i = 1; i <= 3; i++ ) count(i); } void count(int n { x="2;" printf("%d:x="%d"," n, x); +="2;" printf(" x+2="%d\n",">

点击查看答案
第2题
阅读程序段,分析z=()? void main() { int z; int x=1,y=0; if(!x) y++; else if(x==0) if(x) y+=2; else y+=3; z=y; while(1); }

A.3

B.2

C.1

D.0

点击查看答案
第3题
阅读程序 (4)请说出E 类中【代码 1】和【代码 2】的输出结果。 class A { double f(int x,double y) {

3.阅读程序 (4)请说出E 类中【代码 1】和【代码 2】的输出结果。 class A { double f(int x,double y) { return x+y; } int f(int x,int y) { return x*y; } } public class E { public static void main(String args[]) { A a=new A(); System.out.println(a.f(10,10)); //【代码1】 System.out.println(a.f(10,10.0)); //【代码2】 } }

点击查看答案
第4题
【分录题】(4-1)请阅读程序,然后写出程序运行结果。 public class Demo7 { public static void main

【分录题】(4-1)请阅读程序,然后写出程序运行结果。 public class Demo7 { public static void main(String[] args) { int [] arr= new int[5]; int sum=0; Arrays.fill(arr, 3); for(int x:arr) { sum=sum+x; } System.out.println(sum); } }

点击查看答案
第5题
以下程序用于实现a,b两数互换。阅读程序,请在程序空白处将程序补充完整。 #include <stdio.h>
以下程序用于实现a,b两数互换。阅读程序,请在程序空白处将程序补充完整。 #include <stdio.h> void Swap(int *x,int *y); main() { int a, b; a = 15; b = 8; Swap(); printf("a=%d,b=%d",a,b); } void Swap(int *x, int *y) { int temp; temp = *x; *x = *y; *y = temp; }

点击查看答案
第6题
【分录题】(7-1)请阅读程序,并写出程序运行结果。 class X{ int getX() { return 5; } } class Y ex

【分录题】(7-1)请阅读程序,并写出程序运行结果。 class X{ int getX() { return 5; } } class Y extends X{ int getX() { return 6; } } class T extends X{ int getX() { return 7; } } public class Demo10 { public static void main(String[] args) { X x=new X(); Y y=new Y(); X t=new T(); int sum=x.getX()+y.getX()+t.getX(); System.out.println(sum); } }

点击查看答案
第7题
【分录题】(10-8)请阅读程序,然后写出程序运行结果。 public class Demo7 { public static void mai
n(String args[]) { String tom = "Ihaveagreatdream"; String str; int x, y; x = tom.indexOf("a"); y = tom.indexOf("dream", 2); str = tom.substring(5, 7); System.out.println(x+y+str.length()); } }

点击查看答案
第8题
阅读程序。阅读下列C++程序,对每条语句进行注释,说明其作用。 #include <iostream> using na

阅读程序。阅读下列C++程序,对每条语句进行注释,说明其作用。 #include <iostream> using namespace std; class CTest { private: int x, y; public: CTest(int p1 = 0, int p2 = 0) { x = p1; y = p2; } CTest(CTest &p) { x = p.x; y = p.y; } void Show() { cout << x << “, “ << y << endl; } }; int main() { CTest obj1; obj1.Show(); CTest obj2(2, 5); obj2.Show(); CTest obj3(obj2); obj3.Show(); return 0; }

点击查看答案
第9题
【分录题】(9-3)请阅读程序,然后写出程序运行结果。(请注意输出不换行) public class Demo3 { publi
c static void main(String[] args) { int a=9,b=0; double x=9,y=0; try { int c=a/b; }catch(Exception e1) { System.out.print("1"); try { double z=x/y; }catch(Exception e2) { System.out.print("2"); }finally { System.out.print("3"); } }finally { System.out.println("4"); } } }

点击查看答案
第10题
【分录题】(9-3)参照下面的异常类之间的关系图,阅读程序,写出程序运行结果。(注意输出语句不换行)
【分录题】(9-3)参照下面的异常类之间的关系图,阅读程序,写出程序运行结果。(注意输出语句不换行)public class Demo7 { static int x=12; static void createException() { throw new ArrayIndexOutOfBoundsException(); } static void show() { try { createException(); x++; }catch(ArithmeticException e) { x++; }finally { x++; } x++; } public static void main(String[] args) { try { show(); }catch(Exception e) { System.out.print(x); } System.out.println(x); } }

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

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

简答题官方微信公众号

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

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

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