#include<stdio.h>
void swap(int &x,int &y)
{
int temp;
temp=x;
x=y;
y=temp;
}
int main( )
{
int N,A[10000],i,j,min;
while(scanf("%d",&N),N)
{
for(i=0;i<N;i++)
scanf("%d",&A[i]);
min=A[0];
j=0;
for(i=1;i<N;i++)
if(A[i]<min)
{
min=A[i];
j=i;
}
swap(A[0],A[j]);
for(i=0;i<N;i++)
printf(i?" %d":"%d",A[i]);
puts("");
}
return 0;
}
转载于:https://www.cnblogs.com/tangcong/archive/2011/04/28/2031908.html