一些错误我很努力去理解。我正在尝试制作销售税计算器。但由于我不能乘以十进制小数,因此不断出现操作错误。这是我为我的calulate按钮的代码:C#操作符'*'不能应用于'double'和'decimal'类型的操作数
decimal decTax;
decimal decTotal;
string input;
decimal decOrder;
// Accept the order from the Console window
Console.Write("Enter order in dollars: $");
input = Console.ReadLine();
Decimal.TryParse(input, out decOrder);
// Calculate the sales tax
decTax = (0.06D * (decOrder + decTax));
decTotal = (decOrder + decTax);
// Write the results to the Console Window
Console.WriteLine();
Console.WriteLine("The Total is " & decTotal.ToString("c"));
Console.ReadLine();
也不知道为什么我的代码键入如此。我为这样一个新手问题表示歉意,但嘿,即时学习。 –
my line:decTax =(0.06D *(decOrder + decTax)); 得到不能使用“*”作为双倍或小数的操作错误 –