![](https://lstatic.shangxueba.com/jiandati/h5/images/m_q_title.png)
阅读程序: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
阅读程序: 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
阅读程序,给出程序的执行结果: #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",">
A.3
B.2
C.1
D.0
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-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); } }
【分录题】(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); } }
阅读程序。阅读下列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; }
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!