标签:lin adk line OLE color res core [] 冒泡排序
int[] scores = { 89, 90, 98, 56, 60, 91, 93, 85 }; Console.WriteLine("排序前:"); foreach(int score in scores) { Console.Write(score + " "); } Console.WriteLine(); Console.ReadKey(); int temp; for (int i = 0; i < scores.Length - 1; i++) { for(int j = i + 1; j < scores.Length; j++) { if (scores[i] < scores[j]) { temp=scores[i]; scores[i] = scores[j]; scores[j] = temp; } } } Console.WriteLine("从大到小排序:"); foreach (int score in scores) { Console.Write(score + " "); } Console.ReadKey();
标签:lin adk line OLE color res core [] 冒泡排序
原文地址:https://www.cnblogs.com/xixixing/p/9565132.html