12-09工作整理

//①冒泡法排序
//方法一:
int[] list = { 190, 110, 15, 120, 550, 9, 60 };
for (int i = 0; i < list.Length; i++)
{
   for (int j = i + 1; j < list.Length; j++)
    {
		if (list[i] > list[j])
		{
            int temp = list[i];
            list[i] = list[j];
            list[j] = temp;
        }
    }
}
for (int i = 0; i < list.Length; i++)
{
    Response.Write(list[i].ToString() + "<br />");
}
Response.Write("..............................");
//方法二:
int[] abc = { 3, 4, 1, 7, 1000, 5, 9 };
Array.Sort(abc);
for (int i = 0; i < abc.Length; i++)
{
    Response.Write(abc[i].ToString() + "<br />");
}

posted @ 2010-12-10 19:41  kelin418  阅读(99)  评论(0编辑  收藏  举报