Lab 12 Recursion

Lab Activity

The objective of this lab is to learn about recursion in C++. You should first complete the lab quiz. Then find a partner to work on the lab assignment. You should take turns to type in the solution, 10 minutes for each person.

In this lab, you are asked to write recursive functions for functions that has been written in iterative form. You do not need to alter the main() function. Your main task is to write the recursive functions for the tasks below

1. (1 point) Problem 1: Print out all odd positive number that are less than the user input. For example, if the user input is 5, your program should print out 1 3

2. (1 point) Problem  2: Count the number of upper-case letters in a word. For example, if user input is ''heLLo'', your program answer that there are 2 upper-case letters

    

3. (1 point extra credit) Extra-credit Problem: Display a string backward. For example, if user input is "heLLo", your program should display "oLLeh"

Please find the sample and structures in Codio.