int a[10]={2,8,4,6,13,15,3,9,0,11};
//用冒泡法排序
for(int j=0;j<9;j++)
{
for(int i=0;i<9-j;i++)
{
if(a[i]>a[i+1])
{
int temp;
temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
}
}
冒泡法排序,即将最大的数“沉底”。