For this lab, you will write a program that checks whether a particular string is a palindrome. A palindrome is a string that reads the same backwards as forwards. For example "madamImadam" "risetovotesir".
Typically spaces, capitalization and punctuation are ignored in palindromes, meaning "Madam I'm Adam" and "Rise to vote sir" would be considered palindromes. Your program does not need to take this into account, however, and only needs to check for exact palindromes.
You could do this with a loop, but instead you should use the following recursive algorithm:
Enter a phrase: madamImadam
Yes, that is a palindrome!
Enter a phrase: abccba
Yes, that is a palindrome!
Enter a phrase: abcaa
No, that is not a palindrome!
Copyright © 2024 Ian Finlayson | Licensed under a Creative Commons BY-NC-SA 4.0 License.