当前位置:新注册送38元体验金 > 新注册送38元体验金编程 > C#冒泡排序法程序代码,

C#冒泡排序法程序代码,

文章作者:新注册送38元体验金编程 上传时间:2019-08-22

C#冒泡排序法程序代码,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
int[] num = new int[] { 19, 12, 34, 45, 65, 12, 33, 432 };

for (int i = 0; i < num.Length - 1; i )
{
for (int j = 0; j < num.Length - 1 - i; j )
{
if (num[j] > num[j 1])
{
int a = num[j];
num[j] = num[j 1];
num[j 1] = a;
}
}
}
foreach (int number in num)
{
Console.Write(number " ");
}
Console.ReadLine();
}
}
}

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication6 { class Program { static void M...

本文由新注册送38元体验金发布于新注册送38元体验金编程,转载请注明出处:C#冒泡排序法程序代码,

关键词: