Palindrome or not

I want to know if my code is correct . the question is ...
create a program that will check if the given word is a palindrome or not.
this code is running but not sure if it is really correct.
here's my code:
using namespace std;
char word;
int remainder,sum=0;
cout <<"\n\n\n\n [ This program will determine if the given word is a palindrome or not ]";
cout <<"\n\n\n\nEnter a word:";
cin>>word;
word=word;

while(word!=0)
{ remainder=word%10;
word=word/10;
sum=sum*10+remainder;
}if(word==sum)
{cout<<"The word you entered is a Palindrome."<<endl;
} else{
cout<<"The word you entered is not a Palindrome."<<endl;
}cin.get();
cin.get();
system ("pause>0");
return 0;
}
char word; Char is only going to hold a single character. Not sure if single characters qualify as palindromes or not :D Change that to string or array of char.
word=word; Don't need that. Does nothing.

The logic of checking is just not right either. Looks like you're checking to see if a number if a palindromic, which isn't going to work the same as a word.
Topic archived. No new replies allowed.