1
class Program
2
{
3
public static void Main()
4
{
5
int[] sortArray ={ 1, 3, 6, 10, 76, 4, 54, 33, 11, 24, 44 };
6
FuncSort(sortArray);
7
Console.ReadLine();
8
}
9
10
public static void FuncSort(int[] sortArray)
11
{
12
13
int tempInt;
14
for (int i = 0; i < sortArray.Length; i++)
15
{
16
for (int j = i + 1; j < sortArray.Length; j++)
17
{
18
if (sortArray[i] > sortArray[j])
19
{
20
tempInt = sortArray[i];
21
sortArray[i] = sortArray[j];
22
sortArray[j] = tempInt;
23
}
24
}
25
}
26
27
foreach (int i in sortArray)
28
{
29
Console.Write("{0},", i);
30
}
31
32
}
33
}
class Program2
{3
public static void Main()4
{5
int[] sortArray ={ 1, 3, 6, 10, 76, 4, 54, 33, 11, 24, 44 };6
FuncSort(sortArray);7
Console.ReadLine();8
}9

10
public static void FuncSort(int[] sortArray)11
{12
13
int tempInt;14
for (int i = 0; i < sortArray.Length; i++)15
{16
for (int j = i + 1; j < sortArray.Length; j++)17
{18
if (sortArray[i] > sortArray[j])19
{20
tempInt = sortArray[i];21
sortArray[i] = sortArray[j];22
sortArray[j] = tempInt;23
}24
}25
}26

27
foreach (int i in sortArray)28
{29
Console.Write("{0},", i);30
}31

32
}33
}


浙公网安备 33010602011771号