/
ArtT
/
Netology
Обзор
Документация
Войти
/
ArtT
/
Netology
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Part3/Task_3_6_2/Task_3_6_2.cpp
24 строки
870 B
ArtT
Добавил задание 3_6
06 мар 2026, 13:14
06 мар 2026, 13:14
3fc2b0e
Код
Авторство
О чём код?
#include <iostream> #include <vector> #include <set> #include <list> template <class Type> void print_container(Type cont) { for (auto& elem : cont) std::cout << elem << " "; std::cout << std::endl; } int main() { std::set<std::string> test_set = { "one", "two", "three", "four" }; print_container(test_set); // four one three two. помните почему такой порядок? : такой порядок потому что set - это упорядоченный контейнер, по умолчанию сортировка вверх) std::list<std::string> test_list = { "one", "two", "three", "four" }; print_container(test_list); // one, two, three, four std::vector<std::string> test_vector = { "one", "two", "three", "four" }; print_container(test_vector); // one, two, three, four return EXIT_SUCCESS; }