Thread: recursion

  1. #1
    Unregistered
    Guest

    recursion

    my instructor told me not to call main, because it causes recursion.

    Say I am making a calculator, and i want the menu to print again after the user enters the data.

    Can I make a seperate menu function that I can call after each function? Will that cause recursion?

  2. #2
    markv
    Guest
    Recursion is when a function calls itself. It's very useful and you'll learn about it later.

    It sounds like you need a while loop or a do... while loop.

    while the user wants to use the calculator
    Print the menu
    Accept user input
    Ask the user whether or not to continue using the calculator
    End of while

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Template Recursion Pickle
    By SevenThunders in forum C++ Programming
    Replies: 20
    Last Post: 02-05-2009, 09:45 PM
  2. convert Recursion to linear can it be done
    By umen242 in forum C++ Programming
    Replies: 2
    Last Post: 10-15-2008, 02:58 AM
  3. Recursion... why?
    By swgh in forum C++ Programming
    Replies: 4
    Last Post: 06-09-2008, 09:37 AM
  4. a simple recursion question
    By tetra in forum C++ Programming
    Replies: 6
    Last Post: 10-27-2002, 10:56 AM
  5. To Recur(sion) or to Iterate?That is the question
    By jasrajva in forum C Programming
    Replies: 4
    Last Post: 11-07-2001, 09:24 AM