/***********************************************************************
The function reverse(string s) prints the string s in reverse order.
This implementation does not use recursion.
***********************************************************************/
#include <iostream>
#include <string>
using namespace std;
void print_reverse(string s);
int main()
{
string s;
cout << "Enter a string: ";
cin >> s;
cout << "The reverse of '" << s << "' is '" ;
print_reverse(s);
cout << "'" << endl;
return 0;
}
// return input string reversed
void print_reverse(string s)
{
for(int i = s.length()-1; i>=0; i--)
cout << s[i];
}