#include #include #include #include #include using std::cout, std::endl; template std::ostream& operator<<(std::ostream& out, const std::vector& v) { out << "["; for (size_t i = 0; i < v.size() - 1; ++i) out << v[i] << ", "; if (!v.empty()) { out << v.back(); } out << "]"; return out; } template std::ostream& operator<<(std::ostream& out, const std::pair& p) { out << "(" << p.first << ", " << p.second << ")"; return out; } // Нужно написать функцию pairing int main() { std::vector v {10, 20, 30, 40, 50, 60}; cout << pairing(v) << endl; std::array a {"cat", "dog", "mouse", "elephant", "tiget", "axolotl", "wolf"}; cout << pairing(a) << endl; std::string s {"Cats and dogs!"}; cout << pairing(s) << endl; } /* Программа должна напечатать: [(10, 20), (30, 40), (50, 60)] [(cat, dog), (mouse, elephant), (tiget, axolotl), (wolf, )] [(C, a), (t, s), ( , a), (n, d), ( , d), (o, g), (s, !)] */