冒泡排序

冒泡排序

 int[] a = { 1, 22, 6, 88, 9 };
            for (int i = 0; i < a.Length; i++)
            {
                for (int s = i+1; s < a.Length; s++)
                {
                    if(a[i]>a[s])
                    {
                        int b = 0;
                        b = a[i];
                        a[i] = a[s];
                        a[s] = b;
                    }
                }
                Console.WriteLine(a[i]);
            }
            Console.ReadKey();

 

posted @ 2020-07-01 21:17  我的未来方程式i  阅读(104)  评论(0编辑  收藏  举报