using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Single[] single = new Single[3];
for (int i = 0; i < 3; i++)
{
Console.WriteLine("Please input a number:");
try
{
single[i] = Convert.ToSingle(Console.ReadLine());
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Single temp = single[0],tt=0;
for (int i = 1; i <3; i++)//
判断大小并置换位置
{
if (single[i-1] > single[i])
{
tt = single[i-1];
single[i-1] = single[i];
single[i] = tt;
}
}
string temps ="";
for (int i = 0; i < 3; i++)
{
temps = temps+single[i] + " ";
}
Console.WriteLine("The order is:" + temps);
Console.ReadLine();
}
}
}