冒泡排列-——方法1

从大到小

using System.Threading;

namespace 递减
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("输入个数");

            int[] a = new int[int.Parse (Console.ReadLine())];
            
            int i = a.Length;

            for (int b = 0; b < i-1; b++)
            {
                Thread.Sleep(300);

                Random r = new Random();

                a[b] = r.Next(1,99);


                Console.Write(a[b] + " ");
            }

            for (int x = i - 1; x >= 0; x--)
            {
                for (int y = 0; y < i ; y++)
                {
                    if (a[y] < a[y + 1])//报错
                    {
                        int k = a[y];

                        a[y] = a[y + 1];

                        a[y + 1] = k;
                    }
                }
                Console.WriteLine(a[x] + " ");
            }
            Console.ReadLine();
原文地址:https://www.cnblogs.com/nwj-0613/p/4716250.html