using System;
using System.Collections.Generic;
using System.Text;
namespace wuxiaoguang
{
class Program
{
static void Main(string[] args)
{
double
a = 0, b = 0, c = 0, d = 0;//
中间变量。
try
{
Console.WriteLine("
比较三个数的大小
");
Console.WriteLine("
请输入第一个数按
Enter
结束
");
a = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("
请输入第二个数按
Enter
结束
");
b = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("
请输入第三个数按
Enter
结束
");
c = Convert.ToDouble(Console.ReadLine());
}
catch (Exception)
{
Console.WriteLine("
您输入的不是数字!
");
Console.ReadLine();
}
if (a > b)
{
if (b
d = b; b = c; c = d;
}
else if (a
{
d = a; a = b; b = d;
if (b
{
d = b; b = c; c = d;
if (a
d = a; a = b; b = d;
}
}
Console.WriteLine("
三个由大到小为:
");
Console.WriteLine("{0},{1},{2}",a, b, c);
Console.ReadLine();