Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // разработайте сигнатуру фунции MakeVector по аналогии с фунцией MakeSet из урока Задача 3/3
- #include <algorithm>
- #include <iostream>
- #include <set>
- #include <string>
- #include <vector>
- 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 << " "s;
- }
- cout << endl;
- }
- template <typename Container>
- void EraseAndPrint(Container& container, int position, int half_interval_1, int half_interval_2) {
- auto it_to_erased = container.erase(container.begin() + position);
- PrintRange(container.begin(), container.end());
- it_to_erased = container.erase(container.begin() + half_interval_1, container.begin() + half_interval_2);
- PrintRange(container.begin(), container.end());
- }
- int main() {
- vector<string> langs = {"Python"s, "Java"s, "C#"s, "Ruby"s, "C++"s};
- EraseAndPrint(langs, 0, 0, 2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement