C++ reversing strings

6 replies [Last post]
seantdinh
Offline
SX VIP
Joined: 2009/09/20

I've tried reading the book and searching online for 2 days on finding ways to reverse a string using a for loop. I am a slow learner. This is what i got so far.

#include < iostream >
#include < string >

using namespace std;

int main()
{
cout << "Enter a line of text: ";
string str;
getline(cin, str);

string result = "";

int len = str.length();

for (int = 0; i < len; i++)
{

}

cout << "The string " << str << " has the mirror ends " << result << endl;

return 0;
}

Any help would be good at this point. Thanks