# include <iostream>
using namespace std;
int main()
{
int a[10]={1,8,12,9,11,2,14,5,10,4};
int temp,i,j;
for(i=0;i<=9;i++)
for(j=0;j<=9-i;j++)
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
for(i=0;i<=9;i++)
cout<<a[i]<<" ";
cout<<endl;
return 0;
}
C++冒泡排序法
最新推荐文章于 2024-07-13 21:02:20 发布