#include <IOSTREAM>
using namespace std;
//快速排序
void QuickSort(int array[],int head,int end)
{
if (head<end)
{
int i=head,j=end;
int point = array[head];
while (i<j)
{
while(i<j&&array[j]>=point)
--j;
if(i<j)
array[i++]=array[j];
while(i<j&&array[i]<=point)
++i;
if(i<j)
array[j--]=array[i];
}
array[i]=point;
QuickSort(array,i+1,end);
QuickSort(array,head,i-1);
}
}
void main()
{
int array[]={34,65,12,43,67,5,78,10,3,70},k;
int len=sizeof(array)/sizeof(int);
cout<<"The orginal arrayare:"<<endl;
for(k=0;k<len;k++)
cout<<array[k]<<",";
cout<<endl;
QuickSort(array,0,len-1);
cout<<"The sorted arrayare:"<<endl;
for(k=0;k<len;k++)
cout<<array[k]<<",";
cout<<endl;
}