Program for finding out PALINDROME of a string in c++

Description


In this program first and last characters of string is compared one by one moving towards centre.

Here string is entered in the variable ‘st’ of type String by user.

Now string is converted into upper case by first for loop and saved in new string variable ‘str’, this is done to ignore the conditions when the entered string is like ‘RAcecar’,after converting ,it becomes like ‘RACECAR’.

In second for loop we take first and last characters of string and compare them,

if they are equal ‘if’ condition is not executed and looping countinuos by incrementing first and decrementing lastvariables

if they are not equal ‘if’ condition is executed and looping terminates through break statement and flag is assinged the vale 0

Now variable flag is compared for checking the Palindrome.

SOURCE CODE
OUTPUT

Author Description

humanz

Our mission is to bring the affordable Technology education to people everywhere, in order to help them achieve their dreams and change the world. - Follow @program_guide

No comments yet.

Join the Conversation