Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <algorithm>
- #include <vector>
- int main() {
- auto show = [](auto const & sv) {
- for (auto const nr : sv) {
- std::cout << std::setw(3) << nr;
- }
- std::cout << std::endl;
- };
- std::vector<int> array { 10, 2, 0, 14, 43, 25, 18, 1, 5, 45, 3, 15, 16, 8, 9, };
- show(array);
- std::sort(array.begin(), array.end());
- show(array);
- std::cout << std::endl;
- std::vector<int> reverse;
- std::copy(array.crbegin(), array.crend(), std::back_inserter(reverse));
- show(reverse);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement