冒泡排序算法

List<Student> stus=new List<Student>();

double temp;

for (int i = 0; i < stus.Count - 1; i++)

{

  for (int j = i + 1; j < stus.Count; j++)
  {
    if (stus[i].Score > stus[j].Score)
    {
      temp = stus[i].Score;
      stus[i].Score = stus[j].Score;
      stus[j].Score = temp;
    }
   }
}

posted @ 2017-09-22 10:55  沉迷在代码的程序员  阅读(106)  评论(0)    收藏  举报