namespace rojak2.cs
{
class Program
{
static void Main(string[] args)
{
ArithmeticOperators();
}
static void ArithmeticOperators()
{
double totalAmount = 100;
double result;
Console.WriteLine("totalAmount is {0}", totalAmount);
Console.WriteLine();
result = totalAmount + 100;
Console.WriteLine("totaAmount is {0}", result);
result = totalAmount - 50;
Console.WriteLine("totaAmount is {0}", result);
result = ++totalAmount;
Console.WriteLine("totaAmount is {0}", totalAmount);
result = --totalAmount;
Console.WriteLine("totaAmount is {0}", totalAmount);
}
}
}
我的問題是爲什麼最後輸出的結果是100不是99?它應該從100而不是101減少。我不太明白。總增量和減量
以'.cs'結尾的命名空間名稱真的很奇怪,因爲命名空間不需要(也不應該!)與文件一對一映射。 – svick 2012-03-10 14:26:44