Question: C++ A palindrome is a string that reads the same backward as forward. For example, the words mo m, dad, madam and radar are all

C++

A palindrome is a string that reads the same backward as forward. For example, the words mom, dad, madam andradar are all palindromes. Write a class Pstring that is derived from the STL string class. The Pstring class adds a member function

bool isPalindrome()

that determines whether the string is a palindrome. Include a constructor that takes an STL string object as parameter and passes it to the string base class constructor. Test your class by having a main program that asks the user to enter a string. The program uses the string to initialize a Pstring object and then calls isPalindrome() to determine whether the string entered is a palindrome.

You may find it useful to use the subscript operator [] of the string class: if str is a string object and k is an integer, then str[k] returns the character at position k in the string.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!