谢谢你
using System;using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication27
{
class Program
{
static void Main(string[] args)
{
int[] arr = new int[] {1,5,6,9,2,45,36 };
Console.Write("输出这组数");
for (int i = 0; i < arr.Length - 1; i++)
{
System.Console.WriteLine(arr[i]);
}
foreach (int m in arr) {
Console.Write(m +" ");
Console.WriteLine();
for (int i = 0; i < arr.Length - 1;i++ ) {
int j=i+1;
id: if (arr[i]>arr[j]){
int t;
t = arr[i];
arr[i] = arr[j];
arr [i+1]=t;
goto id;
}
else
if (j < arr.Length-1) {
j++;
goto id;
}
}
foreach (int n in arr ){
Console.Write(n+" ");
Console.WriteLine("排序之后的数组");
for (int i = 0; i < arr.Length - 1; i++) {
System.Console.WriteLine(arr [i]);
}
System.Console.ReadLine();
}
}
}
}
}