Hi
thanks for the fast reply, one more question, is there anyway to have
the new reversed string assigned to another string
const string message("my message will never be changed");
string revstr // create a new string
revstr=reverse(message.begin(), message.end()); // does not work but
// this is the type of syntax I am looking for, I am using watcom 1.3
//with stl port, so it works without the std::reverse
adrian
thanks
Rolf Magnus wrote:
adrian suri wrote:
HI
does anyone know of a quike way to reverse an stl string
Yes. std::reverse().
#include <Iostream>
That must be:
#include <iostream>
using namespace std;
#include<string>
#include<cstdlib> // includes clearscreen function exit etc
#include <algorithm>
string firstName;
cout<< "Please enter your first name" <<endl;
cin>>firstName;
firstnameLeng=firstName.size();
firstName.reverse() // does not work
std::reverse(firstName.begin(), firstName.end());