Advertisement
kutuzzzov

Урок 3-1

Oct 4th, 2022 (edited)
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <set>
  6.  
  7. using namespace std;
  8.  
  9. template<typename Iterator>
  10. void PrintRange(Iterator container_begin, Iterator container_end) {
  11.     for (auto it = container_begin; it != container_end; ++it) {
  12.         cout << *it << " "s;
  13.     }
  14.     cout << endl;
  15. }
  16.  
  17. int main() {
  18.     cout << "Test1"s << endl;
  19.     set<int> test1 = { 1, 1, 1, 2, 3, 4, 5, 5 };
  20.     PrintRange(test1.begin(), test1.end());
  21.     cout << "Test2"s << endl;
  22.     vector<int> test2 = {}; // пустой контейнер
  23.     PrintRange(test2.begin(), test2.end());
  24.     cout << "End of tests"s << endl;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement