int[] a ={1,2,3,4,5,6,7,8,9,10};
int aa;
//使用冒泡对数组进行降序排序
for (int i = 0; i < a.Length; i++)
{
for (int j = 0; j < a.Length-i-1; j++)
{
if (a[j] < a[j + 1])
{
aa = a[j];
a[j] = a[j + 1];
a[j + 1] = aa;
}
}
Console.Write(a[i] + "\t");
}
相关分类