Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iterator>
- #include <algorithm>
- #include <vector>
- #include <set>
- #include <map>
- using namespace std;
- template<typename It>
- void PrintRange(It range_begin, It range_end)
- {
- for (auto it = range_begin; it != range_end; ++it)
- {
- cout << *it << " ";
- }
- }
- int main()
- {
- vector <string> langs = { "Python", "C++", "C", "Java", "C#" };
- vector<string> c_langs;
- auto it = copy_if(begin(langs), end(langs), back_inserter(c_langs),
- [](const string& lang)
- { return lang[0] == 'C'; });
- PrintRange(begin(c_langs), end(c_langs));
- //////////////////////////////////////////////////////////////////////////////////////////////
- set<int> a = { 1,3,8 };
- set<int> b = { 3,7,8 };
- set<int> res;
- auto it2 = set_intersection(begin(a), end(a), begin(b), end(b), inserter(res, end(res)));
- PrintRange(begin(res), end(res));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement