C#新手,有问题求大神帮忙。不知道程序哪里出错,与预期结果不同。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace study1
{
class Program
{
static void Main(string[] args)
{
string comparion;
Console.WriteLine("enter a number:");
double var1 = Convert.ToDouble(Console.Read());
Console.WriteLine("enter another number:");
double var2 = Convert.ToDouble(Console.Read());
if (var1 == var2)
comparion = "equal to";
else
if(var1>var2)
comparion = "higher than";
else
comparion = "less than";
Console.WriteLine($"{var1} is {comparion} {var2} ");
Console.ReadKey();
}
}
}