A string is a palindrome if it reads the same from front to back as it does from back to front (e.g. "kayak", "rotator"  and "noon" are palindromes). When determining whether an alphanumeric string is a palindrome, we often ignore spaces, punctuation and case in the string (e.g. "A man, a plan, a canal --Panama!" is also considered a palindrome). Write a complete C program to read a string,  echo it to the screen, determine whether it is a palindrome, and write a message indicating whether it is or isn't.  Your main function should prompt for the string, read the string, print it, call the clean function (to remove all spaces, punctuation, and turn uppercase letters into lowercase letters), print the new string, then call the reverse function (to place the characters into reverse order) and print the new string resulting. In the final step, you will compare the result of the reverse function with the original string and print a message if the string is a palindrome or not. The clean function takes the original string and removes all characters that are not alphanumeric and converts letters to lowercase if necessary. Its prototype (header) is void clean (char before[], char after[]) The reverse function places the characters of the original string in reverse order (ex: "abcde" becomes "edcba"). You must use a recursive solution for this function (no loops!).  Its prototype (header) is void reverse (char before[], char after[])

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

A string is a palindrome if it reads the same from front to back as it does from back to front (e.g. "kayak", "rotator"  and "noon" are palindromes). When determining whether an alphanumeric string is a palindrome, we often ignore spaces, punctuation and case in the string (e.g. "A man, a plan, a canal --Panama!" is also considered a palindrome).

Write a complete C program to read a string,  echo it to the screen, determine whether it is a palindrome, and write a message indicating whether it is or isn't. 

  1. Your main function should prompt for the string, read the string, print it, call the clean function (to remove all spaces, punctuation, and turn uppercase letters into lowercase letters), print the new string, then call the reverse function (to place the characters into reverse order) and print the new string resulting. In the final step, you will compare the result of the reverse function with the original string and print a message if the string is a palindrome or not.
  2. The clean function takes the original string and removes all characters that are not alphanumeric and converts letters to lowercase if necessary. Its prototype (header) is
    void clean (char before[], char after[])
  3. The reverse function places the characters of the original string in reverse order (ex: "abcde" becomes "edcba"). You must use a recursive solution for this function (no loops!).  Its prototype (header) is
    void reverse (char before[], char after[])

 

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT