求改正一下
using System;using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 希尔排序
{
class Program
{
static void Main(string[] args)
{
int[] org = new int[15];
int i, j,d,temp=0 ;
Console.Write("输入待排序元素:\n");
for (i = 0; i < org.Length; i++)
{ org[i] = Convert.ToInt32(Console.ReadLine()); }
for ( d = 5; d > 0; d = d - 2)
{
for (i = d; i < org.Length; i += d)
{if(org[i]<org[i-d])
temp=org[i];
for(j=i;j>0&&org[j-d]>temp;j-=d )
{org[j]=org[j-d];}
org[j]=temp;
}
}
Console.WriteLine("-------输出结果---------");
for (i = 0; i < org.Length; i++)
{
Console.WriteLine(org[i] + "\t")
;
}
Console.ReadLine();
}
}
}