I think the easiest way to reverse a string would be by using the inbuilt reverse function.
Including the header file #include you can:
#include
#include
int main()
{
std::string str = "Programming";
std::reverse(str.begin(), str.end());
std::cout << str;
return 0;
}
Output:
gnimmargorP