Remember that reversing a string in C++ is this easy:
1 2 3 4 5 6 7 8 9 10 11 |
#include <iostream> #include <string> int main() { std::string myString = "Hello World!"; std::cout << myString << "\n"; std::reverse(myString.begin(), myString.end()); std::cout << myString << "\n"; } |