c#实现排序请各位帮忙
堆排序?排序一般用冒泡法 2个for循环using ;using System.Collections.Generic;using System.Text;namespace test{ class Program { static void Main(string[] args) { Console.WriteLine("你好!"); int[] a = new int[10]; Random r = new Random(); for (int i = 0; i < a.Length; i++) { a[i] = r.Next(0, 100); } //随机数组生成 并且显示 for (int i = 0; i < a.Length; i++) { Console.WriteLine("排序前数组的第{0}个数字是{1}", i, a[i]); } //开始排序 从小到大 Console.WriteLine("--------------------------------开始排序 从小到大----------------------------"); for (int i = 0; i < a.Length; i++) { for (int j = 0; j < i; j++) { int temp = 0; if (a[i] < a[j]) { temp = a[j]; a[j] = a[i]; a[i] = temp; } } //外循环控制循环次数 } //循环结束 输出 for (int i = 0; i < a.Length; i++) { Console.WriteLine("排序后数组的第{0}个数字是{1}", i, a[i]); } Console.WriteLine("按任意键继续"); Console.ReadLine(); } }}}本人也是c#新学者 我在csdn有个群组 你不嫌弃的话 就请加入吧 谢谢