提交 d6bd92ff 编写于 作者: Y ycy-ycy

Update

上级 813a656d
......@@ -98,6 +98,7 @@ namespace test
Console.WriteLine("c1={0}, c2={1}", SampleClass.c1, SampleClass.c2);
myClass mc = new myClass();
mc.aFunc();
mc.afunc1();
Console.ReadLine();
}
}
......
......@@ -32,5 +32,37 @@ namespace test
c = --a;
Console.WriteLine("Line 7 - c 的值是 {0}", c);
}
public void afunc1()
{
int a = 1;
int b;
// a++ 先赋值再进行自增运算
b = a++;
Console.WriteLine("a = {0}", a);
Console.WriteLine("b = {0}", b);
Console.ReadLine();
// ++a 先进行自增运算再赋值
a = 1; // 重新初始化 a
b = ++a;
Console.WriteLine("a = {0}", a);
Console.WriteLine("b = {0}", b);
Console.ReadLine();
// a-- 先赋值再进行自减运算
a = 1; // 重新初始化 a
b = a--;
Console.WriteLine("a = {0}", a);
Console.WriteLine("b = {0}", b);
Console.ReadLine();
// --a 先进行自减运算再赋值
a = 1; // 重新初始化 a
b = --a;
Console.WriteLine("a = {0}", a);
Console.WriteLine("b = {0}", b);
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册