首页 - 图片 - 汽车 - 百科 - 旅游 - 美食 - 英语 - IT资讯 - 留学 - 移民 - 电影 - 下载 - 站点地图

您的位置: 易飞网 >> 资讯 >> 电脑网络 >> C#学习资料 >> 查看资讯

C#算法(一)选择排序

     嗨!朋友们,C#将是未来网络开发的首选语言。本人用了C#开发出选择排序算法。希望能为C#语言的学习者带来一些益处。
  
   不要忘了,学语言要花大力气学数据结构和算法。
  
  using System;
  public class SelectionSorter
  {
   // public enum comp {COMP_LESS,COMP_EQUAL,COMP_GRTR};
   private int min;
   // private int m=0;
   public void Sort(int list)
   {
   for(int i=0;i<list.Length-1;++i)
   {
   min=i;
   for(int j=i+1;j<list.Length;++j)
   {
   if(list<list)
   min=j;
   }
   int t=list;
   list=list;
   list=t;
   // Console.WriteLine("{0}",list);
   }
  
   }
  }
  public class MainClass
  {
   public static void Main()
   {
   int iArrary=new int{1,5,3,6,10,55,9,2,87,12,34,75,33,47};
   SelectionSorter ss=new SelectionSorter();
   ss.Sort(iArrary);
   for(int m=0;m<=13;m++)
   Console.WriteLine("{0}",iArrary);
  
   }
  }
   已经成功的编译。