Palindrome Sentences

The user is suppose to input a sentence and im suppose to output the palindrome words. So far, it can only take one word and rejects any sentences.

here is what i have:

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

int main()
{
string s;

cin.clear();

cout<<"Eneter a word"<<endl;
getline(cin,s);
cin.ignore(1);

system("pause");
system("cls");


if(s == string (s.rbegin(), s.rend()))
{ cout<<"palindrome"<<endl;
cout<<endl;
cout<< s <<endl;
cout.fixed;
}
else{ cout<<"NO"; }

system("pause");
return 0;

}
Topic archived. No new replies allowed.