How to find given string is palindrome or Not

Category:

//PROGRAM to find given string is palindrome
#include < iostream>
#include < iomanip>
using namespace std;
void main()
{
char str[10],*end,*start=str;
int len;
cin>>str;
len=strlen(str);
end=str+len-1;
while(str <= end)
{
if(*start==*end)
{
start++;
end--;
}
else
break;
}
if(start>end)
{
cout << "Palindrome" << endl;
}
else
cout << "Not Palindrome" << endl;
system("pause");
}

Comments (0)

Post a Comment