English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2 answers

i think u have outputted the palindrome i.e. reverse of the word inputted. but u see that palindrome of the word is itself so u will get the same word RADAR. ur program should better output whether it is palindrome or not.
here is the program

#include"iostream.h"
#include"string.h"

int ispalindrome( char * ptr)
{
char * revptr = new char[ strlen(ptr )];
int j=strlen(ptr) -1;
for( int i=0;i {
revptr[i] = ptr[j];
j++;
}
if( strcmp ( ptr, revptr) == 1)
return 1;
else
return 0;
}
void main()
{
if (ispalindrome( "RADAR"))
cout<<" is palindome";
else
cout<<" not palindrome";
}

2007-02-26 16:26:59 · answer #1 · answered by Anonymous · 0 0

It's "palindrome", not "parlindrome", but what's the question? Is the question how to IDENTIFY a palindrome, or how to create a palindrome, or... ?

2007-02-26 15:56:03 · answer #2 · answered by T J 6 · 0 0

fedest.com, questions and answers