C#数组排序

版本比较旧了,就当一个思路的参考。


 1         private int[] sortArray(int[] input)
 2         {
 3             bool SwapMark = false;
 4             for (int i = 0; i < input.Length & !SwapMark; i++)
 5             {
 6                 for (int j = i + 1; j < input.Length; j++)
 7                 {
 8                     SwapMark = true;
 9                     if (input[i] < input[j])
10                     {
11                         int temp = input[i];
12                         input[i] = input[j];
13                         input[j] = temp;
14                         SwapMark = false;
15                     }
16                 }
17             }
18             return input;
19         }

 

posted @ 2010-11-02 10:58  思维的边疆  阅读(308)  评论(1编辑  收藏  举报