Odpowiedź:
#include <iostream>
#include <string>
#include <algorithm>
int main() {
int n;
std::cout << "Podaj liczbe\n";
std::cin >> n;
std::string n_string = std::to_string(n);
std::reverse(n_string.begin(), n_string.end());
std::cout << "Odwrocona liczba to " << n_string;
return 0;
}
Wyjaśnienie:
Chyba tak najprościej, chociaż można to na wiele sposobów zrobić