• 2022-06-12
    分析以下C#代码,其运行结果是______ using System;class Test{ public static void Main() { int x = 5; int y = x++; y=++x; Console.Write (y); }}
  • 7

    内容

    • 0

      下面代码的输出结果是。int x = 5;int y = x++;Console.Write(y+" ");y = ++x;Console.Write(y);

    • 1

      请阅读下面的程序 public class Test { public static void main(String[] args) { int x; int y; for (x = 1, y = 1; x <= 100; x++) { if (y >= 20) { break; } if (y % 3 == 1) { y += 3; continue; } y -= 5; } System.out.println(“x=” + x + “,y=” + y); } } 下列选项中,哪一个是程序的运行结果( )

    • 2

      智慧职教: 以下给出代码运行后的结果是? public class Example { public static void main(String&#91;&#93; args) { int x=1; int y=~x+1; System.out.println(x+" "+y); } }

    • 3

      下面程序输出的结果是( )。 #include<iostream> using namespace std; class A int X; public: A(int x):x(++x) ~A()cout<<x; ; class B:public A int y; public: B(int y):A(y),y(y) ~B()cout<<y;; ; void main() B b(3); A: 34 B: 43 C: 33 D: 44

    • 4

      以下程序运行结果是 public class Test { public static void main(String[] args) { int a=1,b[]={2}; add(a); add(b); System.out.println(a+","+b[0]); } static int add(int x){ x++; return x; } static void add(int[] x){ x[0]++; } }