C Plus Plus Recursion Current World Population Program
Description
Write a CPP program to do the following using recursion: (refer to the textbook chapter 19 in the attachment)
1. Using the current estimated population of 8 Billion and an estimated growth rate of 1.05%, compute the estimated year when the population year could exceed over 20 Billion.
2. Display the year (2xxx) and estimated population values for each year as you do this processing.
3. Start with the current year and display the data in ascending order. I am specifying this as it is possible to report this in descending order if the display is done after the recursion.
For this assignment, create a method that calls itself recursively, passing the year and current population to itself. You can increase the population by applying * 1.0105 to increase by 1.05%. This method can return void and thus should do all the displays and computations needed. Display the year processed and estimated population value..
The variable for the population should be a double data type. Do not allow the display to be in scientific notation. The following can help with that issue:
#include<iomanip>
cout << fixed << setprecision(11); // done once
DO NOT USE GLOBAL VARIABLES, STATIC VARIABLES OR LOOP CONSTRUCTS.
DO NOT USE REDUCED NUMBERS – (13.98 or 20)
Unformatted Attachment Preview
19 Recursion
TOPICS
19.1
19.2
19.3
19.4
19.5
19.1
Introduction to Recursion
Solving Problems with Recursion
Focus on Problem Solving and
Program Design: The Recursive
gcd Function
Focus on Problem Solving and
Program Design: Solving Recursively
Defined Problems
Focus on Problem Solving and
Program Design: Recursive Linked
List Operations
19.6
Focus on Problem Solving and
Program Design: A Recursive
Binary Search Function
19.7 The Towers of Hanoi
19.8 Focus on Problem Solving
and Program Design:
The QuickSort Algorithm
19.9 Exhaustive Algorithms
19.10 Focus on Software Engineering:
Recursion vs. Iteration
Introduction to Recursion
CONCEPT: A recursive function is one that calls itself.
You have seen instances of functions calling other functions. Function A can call function
B, which can then call function C. Itàalso possible for a function to call itself. A function
that calls itself is a recursive function. Look at this message function:
void message()
{
cout 0)
{
cout 0
{
cout 0)
{
cout
Purchase answer to see full
attachment
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."