我不确定为什么但是我的控制台应用程序输出显示一个空白屏幕后我没有调试它,并且在microsoft visual studio上没有错误。
以下是我正在运行的代码:
using System;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
decimal apple;
decimal watermelon;
decimal oranges;
decimal grapes;
decimal milk;
decimal soda;
decimal subTotal;
decimal tax,total;
apple = Convert.ToDecimal(Console.ReadLine());
watermelon = Convert.ToDecimal(Console.ReadLine());
oranges = Convert.ToDecimal(Console.ReadLine());
grapes = Convert.ToDecimal(Console.ReadLine());
milk = Convert.ToDecimal(Console.ReadLine());
soda = Convert.ToDecimal(Console.ReadLine());
subTotal = apple + watermelon + oranges + grapes + milk + soda;
Console.Write(" Apple: ${0}",apple);
Console.Write(" watermelon: ${0}",watermelon);
Console.Write(" oranges: ${0}",oranges);
Console.Write(" grapes: ${0}",grapes);
Console.Write(" milk: ${0}",milk);
Console.Write(" soda: ${0}",soda);
Console.WriteLine(" Subtotal: ${0}", String.Format("{0:0.00}", subTotal));
tax = subTotal * (0.065M);
total = tax + subTotal;
Console.WriteLine(" Tax: ${0}", String.Format("{0:0.00}", tax));
Console.WriteLine(" Total: ${0}", String.Format("{0:0.00}", total));
}
}
}
答案 0 :(得分:0)
尝试添加Console.ReadLine()以保留代码末尾的屏幕。