namespace ConsoleApplication10 { class Program { public double[] paixu(double[] a) { double temp; for (int i = 0; i < a.Length; i++) { for (int j = i; j < a.Length - 1; j++) { if (a[i] < a[j + 1]) { temp = a[i]; a[i] = a[j + 1]; a[j + 1] = temp; } } } return a; } static void Main(string[] args) { double[] a = new double[5]; for (int i = 0; i < a.Length; i++) { a[i] = Convert.ToInt32(Console.ReadLine()); } Console.WriteLine(a); new Program().paixu(a); for (int i = 0; i <a.Length; i++) { Console.WriteLine(a[i]); } Console.ReadLine(); } } }
时间: 2024-11-11 23:30:38