Question: in c++ Question 1 Write a C++ program with two functions that compute the Factorial and a main0 function. The first function should use the

 in c++ Question 1 Write a C++ program with two functions

in c++

Question 1 Write a C++ program with two functions that compute the Factorial and a main0 function. The first function should use the recursive definition for the factorial, while the second should use an iterative approach. Verify that both functions are producing correct results, then in your main) function compare their performance by measuring the execution times for Fact(8), Fact(16), Fact(32), Fact(40), Fact(50) Make sure to run each function 3 times for each number and then use the average of the three runs in your comparison. Arrange the results in a table. Is there a difference in the performance? Which one is faster? Question 2 Similar to question 1write a C++ program with two functions that compute the Fibonacci numbers and a main( function. The first function should use the recursive definition for Fibonacci numbers, while the second should use an iterative approach. Verify that both functions are producing correct results, then in your mainO function compare their performance by measuring the execution times for Fib(8), Fib(10), Fib(16), Fib(20), Fib(30), Fib(40) Make sure to run each function 3 times for each number and then use the average of the three runs in your comparison. Arrange the results in a table. Is there a difference in the performance? Which one is faster

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!