reverse word C++

#include "iostream"
#include "string"

using namespace std;

int main()
{
string first;

//with spaces this will not work
cout<<"Enter the first word";
cin>>first;

const char * cs = first.c_str ();

while(*cs)
{
cs++;
}
cs--;

while(*cs)
{
cout<<(*cs);
cs--;
}

cin>>first;
}

Comments

Popular posts from this blog

Network Security: LAN manager authentication level

Cisco AnyConnect Secure Mobility Client - VPN service not available. The VPN agent service is not responding