Question: In C++ please Write a program that reads a message, and then tests the line for a palindrome. You may assume the message contains 100
Write a program that reads a message, and then tests the line for a palindrome. You may assume the message contains 100 or fewer characters. Therefore, define a global constant N equal to 101, since the last element of a character array must be a 10' (the NULL character). Use N to declare the length of your C-string character array, and a while loop with the getchar ( function to read in characters into the array Use a function called isPalindrome ) that has the following function prototype: bool isPalindrome (char "cstr) The function returns true if the characters stored in the C-string for a palindrome, and false if they do not. You must define two pointers to help you code your solution. The first pointer must initially point the 0th character in the character array, and the second pointer should point to the last character in the line. Then use (move) the pointers to point toward different elements within the string and check to see if you have a palindrome. Ignore non-alpha characters. You may use the isalpha 0 and toupper 0 functions to help you. For instance: bool isPalindrome (charcstr) char front cstr char back-estr strlen (estr) 1; while (front
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
