static void Main(string[] args)
{
string comparison; ///声明一个string变量。
Console.WriteLine(“Enter a number:”);
double var1 = Convert.ToDouble(Console .ReadLine ());
Console.WriteLine(“Enter another number:”);
double var2 = Convert.ToDouble(Console .ReadLine ());
///从用户输入中得到两个double值。
if (var1<var2 )
comparison = “less than”;
else
{
if (var1==var2)
comparison =”equal to”;
else
comparison =”greater than”;
}
///比较var1和var2,并把一个字符串赋给string变量comparison。
Console .WriteLine (“The first number is {0} to the second number.”,comparison );
///输出比较结果。
Console .ReadKey ();
///注:这里if用了嵌套的方式(使执行的代码较少),不用嵌套也可以,不过性能上就……
}