C#冒泡排序
static void Main(string[] arr) { int[] names = {4,2,5,7,6,8,9,1,3,0};
//Array.Sort(names)数组排序 for (int i = 0; i < names.Length; i++) { for (int j = i; j < names.Length; j++) { if (names[i] > names[j]) { int temp = names[i]; names[i] = names[j]; names[j] = temp; } } } for (int i = 0; i < names.Length; i++) { Console.WriteLine(names[i]); } Console.ReadKey(); }