应该是下面这个for循环没有加{},只运行for到后面的第一个";"for( i= j+ i; i< n; i++) if( a[ p]< a[ i]) p= i; if( p!= j){ t= a[ p]; a[ p]= a[ j]; a[ j]= t;}