Skip to content

Instantly share code, notes, and snippets.

@mike-zhang
Created November 11, 2012 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mike-zhang/4056689 to your computer and use it in GitHub Desktop.
Save mike-zhang/4056689 to your computer and use it in GitHub Desktop.
流迭代器和算法一起使用
#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