Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write another function named isPalindrome2() that can detect any of the palindrome phrases above, in addition to the single word palindromes from part 1 There
Write another function named isPalindrome2() that can detect any of the palindrome phrases above, in addition to the single word palindromes from part 1 There are a number of ways to approach this problem. Since capitalization, punctuation, and white space are ignored, here is a suggestion for one way to write isPalindrome2() Force all the letters in the string to be lowercase. Develop and use a void function named toLower() that takes a pass by reference char array as input, and updates the array by changing the value of every capital letter to lowercase. Hint: examine the ASCII table below, notice a simple relationship between capital and lowercase letters? Create a new local array (also 50 elements long), and construct the modified string without any punctuation or space. For example Eva, can I stab bats in a cave? Would become evacanistabbatsinacave Hint: when copying the string, make sure you either copy the null character, or append it to the new string-so it's still a valid C-style string that has a valid terminator (ie. \0' ). Now that you've forced lowercase and removed punctuation and whitespace, simply pass the newly constructed string to your isPalindrome () function, and return it's Boolean output You will then only need to amend the palindromeTest() function to call isPalindrome2() as follows char s[50] {}; = for (s; cin.getline(s, 50);) f cout
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started