#include<iostream>
using namespace std;
const int N=11;
int main()
{
int i,j,temp,b;
int a[11]={25,36,56,88,96,45,10,33,2,36,155};
for(i=0;i<N-1;i++)
{
temp=i;
for(j=i+1;j<N;j++)
{
if(a[temp]>a[j])
temp=j;
}
if(i!=temp)
{
b=a[temp];
a[temp]=a[i];
a[i]=b;}
}
for(i=0;i<N;i++)
cout<<a[i]<<' ';
cout<<endl;
}
[c++]选择排序
最新推荐文章于 2024-05-23 13:23:21 发布