Palindrome String


Program to check whether given string is Palindrome or not in C++





#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
          char s[50],d[50];
          int i;
          clrscr();
          cout<<"\nEnter the String :: ";
          cin>>s;
          strcpy(d,s);
          strrev(d);
          i=strcmp(d,s);
          if(i==0)
                    cout<<"\nThe given string "<<s<< " is Palindrome.";
          else
                    cout<<"\nThe given string "<<s<< " is not Palindrome.";
          getch();
}


OUTPUT::

Enter the String :: mom
The given string mom is Palindrome.


-----

Firoz Memon

Please view my other blogs:

          C++ Codes 4 Beginners

          Java Tips

          Java 4 Beginners

Previous Post Next Post