namespace 冒泡排序
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] Array = {1,3,2,5,6,8,4,9,7,0 };
            int ArrLen = Array.Length,temp;
            for (int i = 0; i < ArrLen-1; i++)
            {
                for (int j = 0; j < ArrLen - 1 - i; j++)
                {
                    if (Array[j] > Array[j + 1])
                    {
                        temp = Array[j];
                        Array[j] = Array[j + 1];
                        Array[j + 1] = temp;
                    }
                }
            }
            for (int i = 0; i < ArrLen; i++)
            {
                Console.WriteLine(Array[i].ToString()+"\n");
            }
            Console.Write("按任意键退出...");
            Console.ReadKey(true);
        }
    }
}
posted on 2013-03-25 11:44  LZU-GIS  阅读(117)  评论(0编辑  收藏  举报