标准模板9

#include<functional>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int intArr[]={30,90,10,40,70,50,20,80};
const int N=sizeof(intArr)/sizeof(int);
vector<int>a(intArr,intArr+N);
cout<<"before sorting:"<<endl;
copy(a.begin(),a.end(),ostream_iterator<int>(cout,"\t"));
cout<<endl;
sort(a.begin(),a.end(),greater<int>());
cout<<"after sorting:"<<endl;
copy(a.begin(),a.end(),ostream_iterator<int>(cout,"\t"));
cout<<endl;
return 0;
}

posted @ 2023-05-11 13:47  不会JAVA的小袁  阅读(9)  评论(0编辑  收藏  举报