Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   help on palendromes (http://www.go4expert.com/forums/help-on-palendromes-t1993/)

bothie 25Nov2006 14:27

help on palendromes
can you assist me with a c++ code that will verify whether an input word or sentence is a PALENDROME.Detailing it as much as you could

pradeep 25Nov2006 14:30

Re: help on palendromes
Here is the C program to check whether a string is palindrome or not.

Code: C

 #define size 26 // u can set the maximum allowable size of the string here
 void main()
     char strsrc[size];
     char strtmp[size];
     printf("\n Enter String: ");
     strcpy(strtmp,strsrc); // create a copy
     strrev(strtmp); // reverse the copied string
     if(strcmp(strsrc,strtmp)==0) // compare the two strings
         printf("\n Entered string \"%s\" is palindrome",strsrc);
         printf("\n Entered string \"%s\" is not    palindrome",strsrc);

shabbir 25Nov2006 14:36

Re: help on palendromes
Just an offtopic comment
Offtopic comment:
Its palindrome and not palendrome.

bothie 25Nov2006 15:19

Re: help on palendromes
thanx ,for the correction ,does the 'strrev' function exists in c++

All times are GMT +5.5. The time now is 05:29.