C++ How to Program (10th Edition)
C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Question
Book Icon
Chapter 21, Problem 21.21E
Program Plan Intro

Printing a String Backward Using Recursion.

Program Plan:

  • Include the required header files.
  • Declare the prototype of the function recursive.
  • Define the “recursive()” function.
    • Check whether str.rend()==rit.
      • If so then return.
      • Else display the current text at rit.
    • Make a call to function recursivewithstrand the next location.
  • Define the “main()” function
    • Create a string variable str.
    • Accept a line of text from user into str.
    • Display the original value of str variable.
    • Display the message “The reversed one is :”.
    • Make a call to function recursivewithstrand a string iterator.

Blurred answer
Students have asked these similar questions
(GREATEST COMMON DIVISOR) The greatest common divisor of integers x and y is the largest integer that evenly divides into both x and y. Write and test a recursive function gcd that returns the greatest common divisor of x and y. The gcd of x and y is defined recursively as follows: If y is equal to 0, then gcd (x, y) is x; otherwise, gcd (x, y) is gcd (y, x % y), where % is the remainder operator.
(Recursive Sequential Search Algorithm) Write and implement a recursive version of the sequential search algorithm.
(Towers of Hanoi: Iterative Solution) Any program that can be implemented recursivelycan be implemented iteratively, although sometimes with considerably more difficulty and considerably less clarity. Try writing an iterative version of the Towers of Hanoi. If you succeed, compareyour iterative version with the recursive version you developed in Exercise 5.36. Investigate issuesof performance, clarity, and your ability to demonstrate the correctness of the programs.
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
Computational Software for Intelligent System Design; Author: Cadence Design Systems;https://www.youtube.com/watch?v=dLXZ6bM--j0;License: Standard Youtube License