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