参考别人的代码
#include <iostream>
using namespace std;
void Qsort(int a[],int low,int high)
{
if (low>=high)
{
return;
}
int first = low;
int last = high;
int key = a[first];
while (first<last)
{
while (first<last&&a[last]>=key)
{
last--;
}
a[first] = a[last];
while(first<last&&a[first]<=key)
{
first++;
}
a[last] = a[first];
}
a[first] = key;
Qsort(a,low,first-1);
Qsort(a,last+1,high);
}
int main()
{
int a[] = {1,3,4,0,7};
Qsort(a,0,4);
for (int i=0;i<=4;i++)
{
cout<<a[i]<<endl;
}
return 0;
}