palindrome

Write your question here.
I am working on palindrome. I am not exactly sure where I am making mistake.
[code]

void palindrom()
{
int skip =0;
char word [80];
char newword[80];
bool flag = true;
cout << " Enter a phrase/ a sentence/ or a word to check whether it is palindrome"<< endl;
cin.getline(word, 80 );
length = strlen( word);
halflength = length/2;

for (int i =0; i< length; i++)
{
word[i] = toupper(word[i]);
}
int i=0;
while (i< 80)
{
//word[i + skip]< 'A' || word[i+ skip] >'Z'

if (word[i + skip]> 'A' || word[i+ skip] < 'Z')

{
newword[i]=word[i+skip];
skip++;
}
else
{skip++;}
i++;
}


for (int j=0 ; j< halflength; j++)
{
if( newword[j] != newword[length -1-j] )
{
flag = false;
}
}
if(flag)
{
cout << " Bingo"<< endl;
}
else
cout << "not a paralindrom"<< endl;

}
Topic archived. No new replies allowed.