1. 写出以下程序的运行结果。 class Test { public static void Main() { int x = 5; int y = x++; Console.WriteLine(y); y=++x; Console.WriteLine(y); Console.WriteLine(x); } } 运行结果:
举一反三
- 写出以下程序的运行结果。using System;class Test{public static void Main(){int x = 5;int y = x++;Console.WriteLine(y);//第1空y=++x;Console.WriteLine(y);//第2空}}
- using System; class Test { public static void Main() { int x = 5; int y = x++; Console.WriteLine(y); y=++x; Console.WriteLine(y); } }
- 读程序写结果.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
- 写出下列程序的运行结果 void main() { int x=10,y=10; Console.WriteLine("x={0},y={1}",x--,--y); }
- 阅读下面的程序,分析代码是否能够编译通过,如果能编译通过,请列出运行的结果。否则请说明编译失败的原因。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);}}