Answer:
#include <iostream>
#include <cstring>
using namespace std;
bool isAPalindrome(char* palindrome);
int main()
{
char palindrome[30];
bool palindrome_check;
cout << "Please enter an word or phrase.\n";
cin.getline(palindrome, 30);
palindrome_check = isAPalindrome(palindrome);
if (palindrome_check = true)
{
cout << "Input is a palindrome\n";
}
else
{
cout << "Inputis not a palindrome\n;";
}
system("pause");
return 0;
}
bool isAPalindrome(char* palindrome)
{
char* front;
char* rear;
front = palindrome;// starts at the left side of the c string
rear = (palindrome + strlen(palindrome)) - 1;//starts at the right side of the c-string. adds the c string plus the incriment value of s
while (front <= rear)
{
if (front = rear)
{
front++;
rear--;
}
else
{
return false;
}
}
return true;
}