标签:style blog color ar for sp div 2014 on
/******************************************************************** @date 2014-9-25 @author Tiger @brief 算法 @details 冒泡排序 ********************************************************************/ using System; class Demo { static void Main() { int[] arr = new int[] { 3, 7, 6, 5 }; int nTemp = 0; for (int i = 1; i < arr.Length; ++i) { bool bFlag = false; for (int j = 0; j < arr.Length - 1; ++j) { if (arr[j] > arr[j + 1]) { nTemp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = nTemp; bFlag = true; } } if (!bFlag) { break; } } for (int i = 0; i < arr.Length; ++i) { Console.WriteLine(arr[i]); } Console.ReadLine(); } }
标签:style blog color ar for sp div 2014 on
原文地址:http://www.cnblogs.com/roronoa-zoro-zrh/p/4042193.html