Re: Is there anything wrong with the code?
As somebody will undoubtedly mention eventually, if you can use the STL then it all becomes dead simple.
Code:
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
const string s1("Tony");
string s2(s1);
reverse(s2.begin(), s2.end());
cout << s2 << endl;
return 0;
}
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman