////// 冒泡排序算法 /// public static void BubbleSort() { int[] array = new int[] { 10, 2, 5, 1, 8, 6, 9 }; int t = 0; for (int i = 0; i < array.Length - 1; i++) { for (int j = 0; j < array.Length; j++) { if (array[i] < array[j])//前一个和当前的比较 { t = array[i]; array[i] = array[j]; array[j] = t; } } } }