namespace _03
{
class Program
{
static void Main(string[] args)
{
//请通过冒泡排序法对整数数组{ 1, 3, 5, 7, 90, 2, 4, 6, 8, 10 }实现升序排序。
int[] ints={1, 3, 5, 7, 90, 2, 4, 6, 8, 10};//(n个数,要拍n-1次)
for (int i = 0; i < ints.Length - 1; i++)//最开始的要排9次,依次8,7,6...
{
for(int j=0;j<ints.Length-1-i;j++)
{
if (ints[j] > ints[j + 1])
{
int temp = ints[j];
ints[j]=ints[j+1];
ints[j + 1] = temp;
}
}
}
for (int i = 0; i < ints.Length; i++)
{
Console.WriteLine(ints[i].ToString());
}
}
}
}