static void Main(string[] args)
{
int[] i = new int[] { 1, 3, 2, 6, 3, 5, 9 };
for (int n = 0; n < i.Length; n++)
{
for (int t = 0; t < n; t++)
{
//倒序
if (i[n] > i[t])
{
int c = i[n];
i[n] = i[t];
i[t] = c;
}
}
}
foreach (int t in i)
{
Console.WriteLine(t);
}
}
冒泡排序
最新推荐文章于 2024-11-07 23:24:07 发布