Recursion

The goal of this lab is to give you a bit more experience with recursion. Complete the steps below:
  1. Create a new Project and add the following code to the project: recursion.cpp
  2. Uncomment CODE FRAGMENT 2, compile and run the program.
  3. Uncomment CODE FRAGMENTS 1 and 3, compile and run the program.
  4. Modify the base case such that instead of returning 0 as the base case sum when the end of the array has been reached it returns the contents of the last element of the array when the last element of the array has been reached.
Email me (srollins@mtholyoke.edu) answers to the following questions by Friday, 3/31/06 - 5pm. Note: I expect your answers to demonstrate a thorough understanding of each concept. You need to think carefully about why you get the output or errors that you get.
  1. Explain the purpose and function of CODE FRAGMENT 1.
  2. Explain what happened at step 2.
  3. Explain the output of step 3. Provide as much detail as possible.
  4. Attach the code you produced in step 4.
  5. Explain the difference between the original code and your modified code (from step 4).

Sami Rollins