I have tried and tried and tried to this Palindrome Finder to work but
I just can't seem to fix it. There are no error messages but it just
keeps saying that everything is a palindrome. Here is the code. If you
would like to help, that would be appreciated.
#include <cstdio>
#include <cstring>
int main ()
{
printf ("---------------------------palFind: v0.4
ALPHA----------------------------------\n");
printf (" Press ctrl+Break to Quit\n\n");
while (true)
{
char name [500];
bool palindrome = true;
fgets (name, 500, stdin);
for (int x = x/2; x <= strlen(name)/2; ++x)
{
if (name [x - 1]= name[strlen(name - x)])
palindrome = true;
else
palindrome == false;
}
if (palindrome == true)
{
printf ("Palindrome! :)\n\n");
fflush (stdin);
}
else if (palindrome == false)
{
printf("Not a Palindrome! :(\n\n");
fflush (stdin);
}
}
fflush (stdin);
scanf("*");
return 0;
}