從大到小排序(區分順序排序和氣泡排序)
阿新 • • 發佈:2019-02-10
/*int[] numbs = { 3,2,9,7,5,6};
int temp = 0;
for (int i = 0; i < numbs.Length; i++)
{
for (int j = i+1; j < numbs.Length; j++)
{
if (numbs[j]>numbs[i])
{
temp = numbs[j];
numbs[j] = numbs[i];
numbs[i] = temp;
}
}
}
foreach (int item in numbs)
{
Console.Write(item+",");
}*/
#endregion
#region 真正的氣泡排序
/*int[] aaa = { 5, 12, 3, 52, 2, 67 };
int temp = 0;
for (int i = 0; i < numbs.Length; i++)
{
for (int j = i+1; j < numbs.Length; j++)
{
if (numbs[j]>numbs[i])
{
temp = numbs[j];
numbs[j] = numbs[i];
numbs[i] = temp;
}
}
}
foreach (int item in numbs)
{
Console.Write(item+",");
}*/
#endregion
#region 真正的氣泡排序
/*int[] aaa = { 5, 12, 3, 52, 2, 67 };