C++ How to Program (10th Edition)
C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 16, Problem 16.13E
Program Plan Intro

Program Plan:

  • Include necessary header files.
  • Declare boolPalindromeTester(string s); function header which will accept a string and return a bool value.
  • Start main() function:
  • Declare string variable “ a ” and bool variable “ c ”.
  • Input string in “ a ”.
  • Call “PalindromeTester” function with argument as “ a ”.
  • Check if return of function is true, then display “string is palindrome” else display “String not a palindrome”.
  • Return and exit main function.
  • Define function boolPalindromeTester(string s).
  • Use transforn function to convert string s to lowercase.
  • Declare two strings “a” and “b”.
  • Use copy_if function to remove said punctuations and copy in new string “a”.
  • Make “b” same as “a”.
  • Use reverse() function on “b” to get reverse of string in “b”.
  • Make check bool value true.
  • Run loop from first string to end, comparing characters of both “a” and “b”. If mismatch is found return false.
  • If loop is fully executed, return true.
  • Blurred answer
    Students have asked these similar questions
    4. (Prime Numbers) An integer is said to be prime if it is divisible by only 1 and itself. For example, 2, 3, 5 and 7 are prime, but 4, 6, 8 and 9 are not. Write a function called isPrime that receives an integer and determines whether the integer is prime or not. Write a test program that uses isPrime to determine and prints all the prime numbers between 1 and 1000. Display 10 numbers per line.
    rin t] (Replace strings) Write the following function that replaces the occurrence of a substring old substring new_substring in the string s. The function returns true if string s is changed, and otherwise, it returns false. bool replace_strings(string& s, with new substring a const string& old_string, const string& new_string) Write a test program that prompts the user to enter three strings, i.e., s, old_string, and new_string, and display the replaced string.
    Programming Language : R programming (R Studio) A twin prime is a prime that has a prime gap of two. Sometimes the term twin prime isused for a pair of twin primes. For example, the five twin prime pairs are (3, 5), (5, 7),(11, 13), (17, 19) and (29, 31). Write a function that returns the number of all twin primepairs between 1 and a given number n.
    Knowledge Booster
    Background pattern image
    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