Problem Solving with C++ (10th Edition)
Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
Question
Book Icon
Chapter 14.1, Problem 5STE
Program Plan Intro

Recursive function:

  • Recursive function is a function that call itself.
    • A function definition may have a call to the function being defined. In such cases, the function is known as recursive.

Blurred answer
Students have asked these similar questions
Write a recursive void function that has one parameter that is a positive integer.  When called, the function writes its argument to the screen backward.  That is,, if the argument is 1234, it outputs the following to the screen: 4321.   I've literally tried to create this program and I have no idea how to make it work.  Please help me.  Is it possible to explain line by line what the code does?
Write an iterative version of the function defined in Self-Test Exercise 2.  (Write a recursive void function that has one parameter that is a positive integer and that writes out that number of asterisks (*) to the screen, all on one line.)
Write a recursive function called draw_triangle() that outputs lines of '*' to form a right side up isosceles triangle. Function draw_triangle() has one parameter, an integer representing the base length of the triangle. Assume the base length is always odd and less than 20. Output 9 spaces before the first '*' on the first line for correct formatting. Hint: The number of '*' increases by 2 for every line drawn. Ex: If the input of the program is: 3 the function draw_triangle() outputs: * *** Ex: If the input of the program is: 19 the function draw_triangle() outputs:    *    ***   *****  *******  ********* *********** ************* *************** ***************** ******************* Note: No space is output before the first '*' on the last line when the base length is 19. if __name__ == '__main__':    base_length = int(input())    draw_triangle(base_length)
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