1 2 3 4 1 4 3 2 5
 
 
 
#include<stdio.h>
int main()
{
 int n,i,temp,cnt,min;
 int str[100];
 while(scanf("%d",&n)!=EOF){
  if(n==0) return 0;
  else{
   for(i=1;i<=n;i++){
    scanf("%d",&str[i]);
   }
   min=str[1];
   cnt=1;
   for(i=2;i<=n;i++){
    if(str[i]<min){
     min=str[i];
     cnt=i;
    }
   }
   if(cnt!=1){
    temp=str[1];
    str[1]=min;
    str[cnt]=temp;
   }
   for(i=1;i<=n;i++){
    printf("%d",str[i]);
    if(i<n) printf(" ");
    else printf("\n");
   }
  }
 }
 return 0;
}
 
 
 
tip:当第一个数最小时要单独打个if判断一下,还有min=str[1]时,cnt=1!