I have a palindrome set up in the system, and running fine.
However, when I type "never odd or even" or "A Man, A Plan, A Canal, Panama", it didn't run properly as if these words in quotation marks are considered palindromes. Where is the loophole on my code re: palindromes esp more than one word
//This palindrome project
//requires for a determination and provide a better understanding
//of such concept in C++ project.
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
char word[30],rev[30],chr;
cout<<"\t\tMy System.\n";
cout<<"\t\t\tMy Version\n\n";
do
{
cout<<"\nPlease enter word or number: ";
cin>>word;
int i, j;
for(i = 0, j = strlen(word) - 1; j >= 0; i++, j--)
rev[i] = word[j];
rev[i] = 0;
if(strcmp(rev,word)==0)
cout<<"The word "<<word<<" is considered a Palindrome.";
else
cout<<"The word "<<word<<" is not considered Palindrome.";
cout<<"\n\nDo you want to try again? Please press Y or N: ";
cin>>chr;
}
while(chr=='y'||chr=='Y');
cin.get ();
return 0;
}