110,577
社区成员
发帖
与我相关
我的任务
分享
int[] needSort = { 1010, 193, 2032, 1, 6, 7, 10, 4, 3, 21 };
int swap;
for (int j = needSort.Length - 1; j > 0; j--)
{
for (int i = 0; i < j; i++)
{
if (needSort[i] > needSort[i + 1])
{
swap = needSort[i + 1];
needSort[i + 1] = needSort[i];
needSort[i] = swap;
}
}
}