Quote:
Originally Posted by Tim Churches
Ulrich Schramme <> wrote:
>
> Georgy Pruss wrote:
> > Knowing what your program should do, could also help.
> > G-:
> >
>
> As far as I know is a palindrome a word that you can read from both
> sides. Sorry, but English is not my native language. So I donīt have
> an
> English example handy. But the German name 'OTTO' is a palindrome.
More test cases:
The very first palindrome:
Madam, I'm Adam.
Some palindromic names of Australian towns:
Tumut
Glenelg
Napoleon's palindrome (definitely apocryphal):
Able was I `ere I saw Elba.
A palindrome commentary on the prohibition of streaking:
Named under a ban, a bared, nude man.
Tim C
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
void main()
{
int count=0;
string std;
cout<<"Please type your string:\n(type # if u does not want to enter more characters: ) ";
getline(cin,std,'\n');
string std1(std.begin(),std.end());
reverse (std1.begin(), std1.end());
int size=(std.length());
for(int i=0;i<std.length();i++)
{
if(std[i]==std1[i])
{
count++;
continue;
}
}
if(count==size)
cout<<"yes it is palindrome\n";
else
cout<<"no it is not a palindrome\n";
}