• 2022-06-12
    读程序写结果.static void Main(string[] args){int X = 0;int Y =X++;Console.WriteLine("Y={0}", Y);Console.WriteLine("X={0}", X);Y = --X;Console.WriteLine("Y={0}", Y);Console.WriteLine("X={0}", X);}程序运行结果为:
    A: Y=0
    B: X=1
    C: Y=0
    D: X=0
  • A,B,C,D

    内容

    • 0

      using System; class Test { public static void Main() { int x = 5; int y = x++; Console.WriteLine(y); y=++x; Console.WriteLine(y); } }

    • 1

      阅读下面的程序,分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。否则请说明编译失败的原因。public class Test02{public static void Main(string[] args){int x = 12; {int y = 96;Console.WriteLine("x is " + x);Console.WriteLine("y is " + y);}y = x;Console.WriteLine("x is " + x);}}

    • 2

      写出以下程序的运行结果。using System;class Test{public static void Main(){int x = 5;int y = x++;Console.WriteLine(y);//第1空y=++x;Console.WriteLine(y);//第2空}}

    • 3

      下面程序段输出的结果是什么 class Sample{ static void Swap(ref int x, ref int y) { int tmp; tmp = x; x = y; y = tmp; } static void Main(string[] args) { int a = 30, b = 40; Swap(ref a, ref b); Console.WriteLine("{0},{1}", a, b); Console.ReadKey(); } }

    • 4

      以下程序的运行结果是( )。 main() { int a=-5,b=1,c=1; int x=0,y=2,z=0; if(c>0) x= x + y; if(a<=0) { if(b>0) if(c<=0) y= x - y; } else if(c>0) y= x - y; else z= y; printf("%d,%d,%d\n", x, y, z); }