Monday, September 5, 2016

Tags

C++  PROGRAM TO CHECK GIVEN STRING IS IN PALLINDROME OR NOT:


#include<iostream>
#include<cstring>
using namespace std;
class PALLINDROME
{
 char str1[100],str2[100];
 public:
  PALLINDROME()
  {
  cout<<"ENTER A STRING ";
  cin>>str1;
 
}
void reverse()
{
strcpy(str2,str1);
strrev(str2);
if(strcmp(str1,str2)==0)
{
cout<<"STRING "<<str1<<" IS IN PALLINDROME";

}
else
{
cout<<"STRING "<<str1<<" IS NOT IN PALLINDROME";
}
}
};
main()
{
PALLINDROME p;
p.reverse();
}