Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Given Sentence Palindrome or Not (http://www.go4expert.com/forums/sentence-palindrome-t22189/)

realtime.funda 23May2010 17:41

Given Sentence Palindrome or Not
 
Hi there...

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

Thanx in advance...

xpi0t0s 24May2010 17:53

Re: Given Sentence Palindrome or Not
 
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.


All times are GMT +5.5. The time now is 09:54.