Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Write a function, isPalindrome, that accepts a string and determines if the string is a palindrome. void isPalindrome(string); A palindrome is any word, phrase,

c++

Write a function, isPalindrome, that accepts a string and determines if the string is a palindrome.

void isPalindrome(string);

A palindrome is any word, phrase, or sentence that reads the same forward and backward. This function must use recursion to solve this problem. The function must accept a string argument that may be a single word or an entire phrase. Spaces and numbers must be considered by the function. These means that "kayak " is not a palindrome because of the extra space at the end, while "kayak" IS a palindrome.

Next, write a driver that prompts the user for a string, and tells the user if it is or is not a palindrome by passing the string to your function. The output should look like this:

***Notice the space after kayak.***

Enter a string to test: kayak

The string 'kayak ' is not a palindrome.

Enter a string to test: kayyak

The string 'kayyak' is a Palindrome

Enter a string to test: kayak

The string 'kayak' is a palindrome.

Enter a string to test: this is a si siht

The string 'this is a si siht' is a palindrome.

Write a good driver. Any non-recursive solution will receive a zero.Submit your single cpp driver file and a screenshot

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions