Could somebody please give me some pointers on my code for palindrome testing. As you can see I am new to Borland programming. I think i have the main points okay but there are still errors.
Many thanks.
int main (int argc int, chr** argv)
{
AnsiString word;
int Index;
int Reverse;
char first;
char Last;
word = ReadStringPr("Enter a word: "
;
Index = 1;
Reverse = 1;
First = Length(word) + 1;
Last = Length(word) - 1;
while (Index <= Length(word))
{
if(First == Last)
Index = Index + 1;
Reverse = Reverse - 1;
}
WriteStringPr("The word is a palindrome."
;
{
else
WriteStringPr("The word is not a palindrome"
;
}
getchar();
return 0;
}
Many thanks.
int main (int argc int, chr** argv)
{
AnsiString word;
int Index;
int Reverse;
char first;
char Last;
word = ReadStringPr("Enter a word: "
Index = 1;
Reverse = 1;
First = Length(word) + 1;
Last = Length(word) - 1;
while (Index <= Length(word))
{
if(First == Last)
Index = Index + 1;
Reverse = Reverse - 1;
}
WriteStringPr("The word is a palindrome."
{
else
WriteStringPr("The word is not a palindrome"
}
getchar();
return 0;
}