Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
流迭代器和算法一起使用
#include <iostream>
#include <iterator>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
istream_iterator<int> cin_it(cin);
istream_iterator<int> end_of_stream;
vector<int> vec(cin_it,end_of_stream);
sort(vec.begin(),vec.end());
ostream_iterator<int> output(cout," ");
unique_copy(vec.begin(),vec.end(),output);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment