This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <iostream>
#include <cstdio>
using namespace std;
int a[101],n;
void quicksort(int left,int right) {
int i,j,t,tmp;
if(left>right)
return ; //当i变为left值,进入第一个递归,right变为0,此时return 结束此递归函数。
tmp=a[left];
i=left;
j=right;
while(i!=j) {
while(a[j]>=tmp && i<j)
j--;
while(a[i]<=tmp && i<j)
i++;
if(i<j) {
t=a[i];
a[i]=a[j];
a[j]=t;
}
a[left]=a[i];
a[i]=tmp;
quicksort(left,i-1);
quicksort(i+1,right);
return ;//此处return结束的是这个quicksort函数
int main() {
int i,j;
cin>>n;
for(i=1; i<=n; i++) {
cin>>a[i];
quicksort(1,n);
cout<<a[i];
return 0;