Created
November 11, 2012 23:24
-
-
Save mike-zhang/4056689 to your computer and use it in GitHub Desktop.
流迭代器和算法一起使用
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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