Question

I need help with this programming challenge from Starting out with C++ 6th ed. by Gaddis....

I need help with this programming challenge from Starting out with C++ 6th ed. by Gaddis. I am looking for help with Chapter 19 programming challenge 11.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear user,
Here is the C++ code to Palindrome Detector:

//Header file section
#include
#include
using namespace std;

/*Recursion function that uses to determine if a string is a palindrome.*/
bool PalindromeDetector(string);

//Start main
int main()
{
string data;
cout<<"Enter a string: ";
getline(cin,data);
cout ;
      if (PalindromeDetector(data))
         cout<       else
         cout<

//Pause a system for a while
system("pause");
return 0;
}
/*A bool function PalindromeDetector uses to determine if a string is a palindrome.
This function return true if the argument reads the same forward and backward.
otherwise its not palindrome
*/
bool PalindromeDetector(string s)
{
bool argument=false;
   if(s.length()<= 1)
      argument=true;
   else if(toupper(s.at(0))==toupper(s.at(s.length()-1)))
     argument=PalindromeDetector(s.substr(1,s.length()-2));
   return argument;
}

---------------------------------------------------------------------
Output 1:

uploaded image

Output2:

uploaded image

Add a comment
Know the answer?
Add Answer to:
I need help with this programming challenge from Starting out with C++ 6th ed. by Gaddis....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT