//n(n<20)个数按从大到小排序
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int cmp(int a,int b)
{
int n1,n2;
if(a > b)
{
n1 = b;
n2 = a;
}
else
{
n1 = a;
n2 = b;
}
return n1 < n2;
}
int main()
{
int n,arr[20],i=0;
cout<<"输入要参与排序的数的个数n(n<20):"<<endl;
cin>>n;
cout<<"输入"<<n<<"个数:"<<endl;
for(;i < n;i++)
cin>>arr[i];
sort(&arr[1],&arr[n-1],cmp);
for(i = 0;i<n;i++)
cout<<arr[i]<<endl;
}
//编译没问题,运行会有错误提示:invalid operation<,忽略两次就可以了。。。偶也不造为嘛/(ㄒoㄒ)/~~