梦想阳光

导航

面试--冒泡排序

int[] array=new array[5]{13,45,23,3,78};

int temp;

for(int i=0;i<5;i++)

{

for(int j=i+1;j<5;j++)

{

if(array[i]>array[j])

{

 temp=array[i];

array[i]=array[j];

array[j]=tem;

}

 

}

console.WriteLine(array[i]);

 

}

posted on 2012-07-13 19:42  梦想阳光  阅读(121)  评论(0)    收藏  举报