C/C++ Program to check whether a string is palindrome or not using string functions [DEVCPP/GCC]

PROGRAM

//Program to check whether a string is palindrome or not using string functions.

#include <iostream>
#include <string.h>              
using namespace std;

int main()
{
char str1[10],str2[10],c;

do
{
cout<<"\nENTER A STRING: ";
cin>>str1;

strcpy(str2,str1);                        //copies the content of str1 to str2

strrev(str1);                                //reverses str1 

if(strcmp(str1,str2)==0)            //compares str1 and str2
cout<<"GIVEN STRING IS PALINDROME";
else
cout<<"GIVEN STRING IS NOT PALINDROME";

cout<<"\n\nDO YOU WISH TO CONTINUE (Y/N)? ";
cin>>c;

  }while(c=='y'||c=='Y');

return 0;
}

OUTPUT

C++ Program to check whether a string is palindrome or not using string functions

FIND US ON FACEBOOK!