Code
#include<iostream>
using namespace std ;
int R[100]= {0};
int Partition ( int R[] , int low , int high )
{
R[0] = R [ low ] ; //暂时存储支点记录
while ( low < high )
{
while ( low < high && R[ high ]>= R [ 0 ] )
high -- ;
if ( low < high )
{
R [ low ] = R [ high ] ;
low ++ ;
}
while ( low < high && R[ low ] < R[ 0 ] )
low ++ ;
if ( low < high )
{
R[ high ] = R [ low ] ;
high -- ;
}
}
R [ low ] = R [ 0 ] ;
return low ;
}
void Quick_Sort( int R[] , int s , int t )
{
int i ;
if( s < t )
{
i = Partition ( R , s , t );
Quick_Sort( R , s , i - 1 ) ;
Quick_Sort( R , i + 1 , t );
}
}
int main ()
{
for (int i = 1 ; i <=10 ; ++ i )
cin>> R[i];
Quick_Sort( R ,1, 10) ;
for ( int j = 1 ; j <= 10 ; ++ j )
cout<<R[j]<<" ";
return 0 ;
}