Starting Out With C++: Early Objects (10th Edition)
Starting Out With C++: Early Objects (10th Edition)
10th Edition
ISBN: 9780135235003
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 14, Problem 8PC
Program Plan Intro

Palindrome Testing

Program Plan:

  • Include the required header files to the program.
  • Declare function prototype.
  • Define the “main()” function. Inside this function,
    • Do until the user enters “ENTER” key using “while” condition.
      • Get a word from the user and store it in a variable “word”.
      • Check if the entered word is empty.
        • If the condition is true then, return 1.
      • Call the function “isPalindrome()” and check if the function returns “true”.
        • If the function returns true then, the entered word is a palindrome.
        • Else, the entered word is not a palindrome.
    • Return the statement.
  • Give function definition for “isPalindrome()”.
    • Check if the value of “lower” is greater than “upper”.
      • Return “true”.
    • Check if the first and the last characters are not equal.
      • Return “false”.
    • Return and call the function “isPalindrome()” recursively.

Blurred answer
Students have asked these similar questions
3. A palindrome is a sentence that contains the same sequence of letters read-ing it either forwards or backwards. A classic example is "Able was I, ere I saw Elba." Write a recursive function that detects whether a string is a palindrome. The basic idea is to check that the first and last letters of the string are the same letter; if they are, then the entire string is a palindrome if everything between those letters is a palindrome. There are a couple of special cases to check for. If either the first or last character of the string is not a letter, you can check to see if the rest of the string is a palindrome with that character removed. Also, when you compare letters, make sure that you do it in a case-insensitive way. Use your function in a program that prompts a user for a phrase and then tells whether or not it is a palindrome. Here's another classic for testing: "A man, a plan, a canal, Panama!"
isset(); is a ------ function. O a Integer O b. None O . Boolean O d. String
In C Language only
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT