C++ Program to check if a string is palindrome.

How to write a Program to check if a string is palindrome in C++ Programming ?

C++ Program to check whether a String is Palindrome or not C++ Program to Check Whether String is Palindrome Program to check a string is palindrome or not - C++ Tutorial C++ Program to check whether a string is PALINDROME Write a c++ program to check whether a string is a palindrom A program to check for palindromes for C++ Code Example C++ program to check whether the given string is Program:To check if a string is a palindrome or not c++ - Check if a string is palindrome palindrome program  c program to check if a string is palindrome using pointers c program to check if a string is palindrome or not check if string is palindrome java check if string is palindrome using recursion check if string is palindrome python check if string is palindrome using stack check if string is palindrome geeksforgeeks
C++ Program to check if a string is palindrome.



Solution:
//Program to check if a string is palindrome.
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
void main()
{
clrscr();
char a[80];
int z=1;
cout<<"Enter a string: ";
gets(a);
int n=strlen(a);
for(int i=0,j=n-1;i<=(n-1)/2;i++,j--)
{
if(a[i]!=a[j])
{
z=0;
break;
}
}
if(z==0)
cout<<"The string is not palindrome.";
else
cout<<"The string is palinrome.";
getch();
}

This C++ Program to check if a string is palindrome.


Learn More :