Question: Hello I have an error with my C++ program when I try to debug it with the strings. The program needs to follow the requirements

Hello I have an error with my C++ program when I try to debug it with the strings. The program needs to follow the requirements stated below. Thanks.

Requirements:

Hello I have an error with my C++ program when I try

Code:

#include

#include

using namespace std;

bool isPalindrome(const string& input)

{

if (input.length()

{

return true;

}

else if (input.at(0) != input.at(input.length() - 1))

{

return false;

}

else

{

return isPalindrome(input.substr(1, input.length() - 2));

}

}

int main()

{

int i,j;

int count;

string testStrings[6] =

{ "ABLE WAS I ERE I SAW ELBA",

"FOUR SCORE AND SEVEN YEARS AGO",

"NOW IS THE TIME FOR ALL GOOD MEN",

"DESSERTS I STRESSED",

"A MAN A PLAN A CANAL PANAMA",

"KAYAK" };

string newStrings;

for ( i = 0; i

{

cout

count=0;

newStrings="";

for( j=0;j

if(isalnum(testStrings[i][j]))

{

newStrings[count++]=tolower(testStrings[i][j]);

}

else{

continue;

}

}

if (isPalindrome(newStrings))

cout

else

cout

}

return 0;

}

In this exercise, we are going to determine whether the user input text string is a palindrome using: built-in features of the string class, such as the constructor, iterator, element access and capacity; recursion; other STL ADT (ref. on Cplusplus.com Containers) such as stack and/or vector to determine whether the user input text string is a palindrome. A palindrome is any word, phrase, or sentence that reads the same forward and backward. Here are some well-known palindromes: Able was I, ere I saw Elba Aman, a plan, a canal, Panama Desserts, I stressed Kayak Write a bool function that uses recursion to determine if a string argument is a palindrome. The function should return true if the argument reads the same forward and backward. Demonstrate the function in a program

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!