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

Share this

Related Posts

1 comments :

comments
July 4, 2020 at 1:09 AM delete

This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. c program to find lcm of n numbers

Reply
avatar

FIND US ON FACEBOOK!