Reverse the string in C++
#include <iostream> #include <cstdlib> using namespace std; main() { beginning: string name; cout << "Hey! Enter your name" << endl; cin >> name; int i = name.length() - 1; do { cout << name[i]; i--; } while (i > -1); cout << " Your reverse name is " << name[i] << endl; cout << name[i] << " Your reverse name is " << endl; goto beginning; } Why the "zsuidakrA" is being displayed before "Your reverse name is" although I have coded like cout<<" Your reverse name is "<<name[i]<<endl; For cout<<name[i]<<" Your reverse name is "<<endl; this line, I have found only "Your reverse name is" but there is