Console.Write("Please type in the first floating point number: ");
double floating_1 = Convert.ToDouble(Console.ReadLine());
Console.Write("Please type in the second floating point number: ");
double floating_2 = Convert.ToDouble(Console.ReadLine());
double product = floating_1 * floating_2;
double difference = floating_1 - floating_2;
double sum = floating_1 + floating_2;
Console.WriteLine("The product of the two floating point numbers is: " + product + "\nThe sum of the two floating point numbers is: " + sum + "\nThe difference between the two floating point numbers is: " + difference);
Console.ReadLine();
我有这段代码。每当我执行程序时,小数点显示不正确(如数字:45.23将显示为4523)。正确显示小数点
您的输入值是多少?你用逗号或点分隔吗? – MUG4N
我正在与一个点分开。 – Leth
问题在哪里..可以详细说明..? –