C++ recursion

We were unable to transcribe this imageRequirements • The user should be able to enter a choice in the menu. Check for input type mismatch. If user selects option 1, the user should then enter the number (n) to calculate the factorial. Use the recursive method and calculate the factorial; as possible display the result from each recursive call until the final result is obtained. If user selects option 2, the user should then enter the number (n) to calculate the Fibonacci Series. Use the recursive method and calculate the Fibonacci Series; as possible display the result from each recursive call until the final result (series) is obtained. If user selects option 3, the user should then enter the number (n) to calculate the factorial. In this case, you will need to run the calculation using both methods, measure the time used to execute each method and display the resulting time (in seconds) for each method. You will not display the actual result. You may need to execute multiple times each calculation to obtain an execution time you can measure. If user selects option 4, the user should then enter the number (n) to calculate the Fibonacci Series. In this case, you will need to run the calculation using both methods, measure the time used to execute each method and display the resulting time (in seconds) for each method. You will not display the actual series. You may need to execute multiple times each calculation to obtain an execution time you can measure. You will need at least 5 functions, one for each of the following tasks: print header, factorial – recursive, factorial – iterative, Fibonacci Series – recursive and Fibonacci Series – iterative. You may need more. You will also need to ensure that the output for each menu option displays the required information listed above. For this assignment we will be using C++ 11, which allow us to support a long long (integer) data type and a more precise time measurement library. See the tutorial part of this assignment with instructions in how to configure Eclipse to use C++ 11. Long long int uses 64 bits to storage an integer value so we can calculate factorial value for larger numbers. The range for unsigned long long int is: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 As part of C++ 11 a new high precision clock library called chrono was included. Such library allows time measurement with precision as greater as microseconds. To measure the execution time of each implementation, you will use the chrono library functions. In addition, you may need to execute multiple times each calculation to obtain an execution time you can measure. For instance, you may need to calculate the result 10 to 1000 times. See the tutorial part of this assignment for a sample code used to measure execution time of a function using the chrono library. rn in as a single PDF file (IN THIS ORDER) 1. Screen 1/0 – cut and paste into a txt file into eclipse. You will need the following six output: a. Option 1 – select a number between 5 and 15 b. Option 2 – select a number between 10 and 25 C. Option 3 – select a number between 5 and 9 d. Option 3 – select a number between 10 and 15 e. Option 4 – select a number between 10 and 25 f. Option 4 – select a number between 30 and 50 2. Header file. 3. Listing of main.cpp 4. Listing of your functions in a separate file from main.cpp. Show transcribed image text

Requirements • The user should be able to enter a choice in the menu. Check for input type mismatch. If user selects option 1, the user should then enter the number (n) to calculate the factorial. Use the recursive method and calculate the factorial; as possible display the result from each recursive call until the final result is obtained. If user selects option 2, the user should then enter the number (n) to calculate the Fibonacci Series. Use the recursive method and calculate the Fibonacci Series; as possible display the result from each recursive call until the final result (series) is obtained. If user selects option 3, the user should then enter the number (n) to calculate the factorial. In this case, you will need to run the calculation using both methods, measure the time used to execute each method and display the resulting time (in seconds) for each method. You will not display the actual result. You may need to execute multiple times each calculation to obtain an execution time you can measure. If user selects option 4, the user should then enter the number (n) to calculate the Fibonacci Series. In this case, you will need to run the calculation using both methods, measure the time used to execute each method and display the resulting time (in seconds) for each method. You will not display the actual series. You may need to execute multiple times each calculation to obtain an execution time you can measure. You will need at least 5 functions, one for each of the following tasks: print header, factorial – recursive, factorial – iterative, Fibonacci Series – recursive and Fibonacci Series – iterative. You may need more. You will also need to ensure that the output for each menu option displays the required information listed above. For this assignment we will be using C++ 11, which allow us to support a long long (integer) data type and a more precise time measurement library. See the tutorial part of this assignment with instructions in how to configure Eclipse to use C++ 11. Long long int uses 64 bits to storage an integer value so we can calculate factorial value for larger numbers. The range for unsigned long long int is: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

As part of C++ 11 a new high precision clock library called chrono was included. Such library allows time measurement with precision as greater as microseconds. To measure the execution time of each implementation, you will use the chrono library functions. In addition, you may need to execute multiple times each calculation to obtain an execution time you can measure. For instance, you may need to calculate the result 10 to 1000 times. See the tutorial part of this assignment for a sample code used to measure execution time of a function using the chrono library. rn in as a single PDF file (IN THIS ORDER) 1. Screen 1/0 – cut and paste into a txt file into eclipse. You will need the following six output: a. Option 1 – select a number between 5 and 15 b. Option 2 – select a number between 10 and 25 C. Option 3 – select a number between 5 and 9 d. Option 3 – select a number between 10 and 15 e. Option 4 – select a number between 10 and 25 f. Option 4 – select a number between 30 and 50 2. Header file. 3. Listing of main.cpp 4. Listing of your functions in a separate file from main.cpp.

## Expert Answer

Answer to Requirements • The user should be able to enter a choice in the menu. Check for input type mismatch. If user selects o…