Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Заготовки кода здесь нет — вы легко справитесь без неё. А вот решение не забудьте сохранить — оно
- вам понадобится в следующем задании.
- */
- #include <iostream>
- #include <set>
- #include <vector>
- using namespace std;
- template <typename It>
- void PrintRange(It range_begin, It range_end){
- bool first = true;
- auto i = range_begin;
- while(i!=range_end){
- if(first){
- cout<<*i;
- first=false;
- }else{
- cout<<" "<<*i;
- }
- ++i;
- }
- if(!first){
- cout<<endl;
- }
- }
- int main() {
- cout << "Test1"s << endl;
- set<int> test1 = {1, 1, 1, 2, 3, 4, 5, 5};
- PrintRange(test1.begin(), test1.end());
- cout << "Test2"s << endl;
- vector<int> test2 = {}; // пустой контейнер
- PrintRange(test2.begin(), test2.end());
- cout << "End of tests"s << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment