- #include<iostream.h>
- #include<algorithm>
- using namespace std;
- short comp(const short &a,const short &b)
- {
- return a>b;
- }
- void main()
- {
- freopen("in.txt","r",stdin);
- freopen("out.txt","w",stdout);
- short i;
- short a[10];
- for(i=0;i<10;i++)
- cin>>a[i];
- sort(a+0,a+10,comp);
- for(i=0;i<10;i++)
- cout<<a[i]<<" ";
- cout<<endl;
- fclose(stdin);
- fclose(stdout);
- }
- //该片段来自于http://www.codesnippet.cn/detail/0708201513378.html
来源: http://www.codesnippet.cn/detail/0708201513378.html