标题:求改正一下
取消只看楼主
冲冲走过
Rank: 2
等 级:论坛游民
帖 子:69
专家分:72
注 册:2011-10-2
结帖率:91.67%
 问题点数:0 回复次数:1 
求改正一下
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();


        }
    }
}
搜索更多相关主题的帖子: class using 元素 
2011-10-04 11:25
冲冲走过
Rank: 2
等 级:论坛游民
帖 子:69
专家分:72
注 册:2011-10-2
得分:0 
大家帮帮忙
2011-10-04 12:08



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-351559-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.050534 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved