#include<iostream>
#include<string>
using namespace std;
int man(){
	string s;
	cout<<"Type something...\n";
	getline(cin,s);
	string::iterator pos;
	for(pos=s.end();pos!=s.begin()-1;pos){
	out<<*pos;
	}
2
Contributors
1
Reply
3
Views
11 Years
Discussion Span
Last Post by ~s.o.s~
0

The code does not even compile. Please verify that the code works before posting it. Next time such imcomplete codes will be deleted...

This time I am ediiting so that it just works..

#include<iostream>
#include<string>
using namespace std;

int main()
{
    string s;
    cout<<"Type something...\n";
    getline(cin,s);
    string::iterator end = s.end( ) - 1;

    for( ; end != s.begin( ) - 1; end--)
    {
        cout << *end;
    }
    return 0 ;
}
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.