Check Entered String Is Palindrome Or Not
Check Whether The Entered String Is Palindrome Or Not Using C++
========================================================================
#include<iostream>
#include <string.h>
using namespace std;
main()
{
char a[100], b[100];
cout<<"Enter the string to check if it is a palindrome Or Not\n";
gets(a);
strcpy(b,a);
strrev(b);
if (strcmp(a,b)==0)
cout<<"Entered string is a palindrome.\n";
else
cout<<"Entered string is not a palindrome.\n";
}
OutPut:
========================================================================
Code By: Kabeer Hussain
0 comments:
Post a Comment