Given Sentence Palindrome or Not

realtime.funda's Avatar, Join Date: May 2010
Newbie Member
Hi there...

Please send me Accurate C++ code to reverse the sentence and find the given sentence is palidrome or not.

Thanx in advance...
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
This is a really easy task and if you cannot do it yourself then you should ask why you are on a programming course in the first place.

Here's a major hint. Look at the string "Hello olleH". What do you notice about characters [0] and [strlen-1]? What do you notice about [1] and [strlen-2]? And in general [n] and [strlen-1-n]? HINT HINT HINT ***for loop***. You can do it in about 6 lines of code, and you don't need to reverse the string to be able to tell if it's a palindrome.