这里写了一个冒泡排序的函数.
int[] a = new int[10] { 12,564,95,44,69,499,693,6746,6496,124};
for(int i=0;i<a.Length;i++)
for (int j = i+1; j < 10; j++)
{
int min = a[i];
if (a[i] > a[j]) //升序排列
{
int t = a[i];
a[i] = a[j];
a[j] = t;
}
}
for(int i=0;i<a.Length;i++)
for (int j = i+1; j < 10; j++)
{
int min = a[i];
if (a[i] > a[j]) //升序排列
{
int t = a[i];
a[i] = a[j];
a[j] = t;
}
}