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 减少。我不太明白。