Results 1 to 5 of 5

Thread: Iteration and recursion in C++ language

  1. #1
    Join Date
    Mar 2011
    Posts
    77

    Iteration and recursion in C++ language

    Last one month, I have work on the C++ programming language. As we all know that this is the Object Oriented Programming Language but now I want to do the Iteration and recursion in this language. I try to write a code for an iteration paradigm or a recursion paradigm. Also I have not understood the difference between these two issues. I think that the performance of Iteration is good as compared to the second. Thanks in advance.

  2. #2
    Join Date
    May 2009
    Posts
    529

    Re: Iteration and recursion in C++ language

    If you have work on the last one month over this language then you knows that the recursive function provide facility the process calling itself until a condition is true. The other Iteration will be use a looping control structure. Few example are to be while loop, do while loop, and for loop. This iteration will be help to re execute a code. This code executing number of times until a condition is true. Then use this issue in appropriate level of the program.

  3. #3
    Join Date
    May 2009
    Posts
    539

    Re: Iteration and recursion in C++ language

    Recursion is to be the technique or the method of the object oriented Programming language. This will be help to call the self statement again and again. Following factorial program are the example of this topic.
    unsigned int factorial (unsigned int x)
    {
    if (x== 1) return 1;
    else {
    x *= factorial(x-1);
    return x;
    }
    };
    This is the perfect example of the recursion. In this the factorial are function that call to itself. In this example, loop executing at four times. The result is result = factorial(4) * factorial(3) *factoria(2) * factorial(1);

  4. #4
    Join Date
    Apr 2009
    Posts
    488

    Re: Iteration and recursion in C++ language

    As you know that this recursion is a worst part of the C++ language and you need to clear all the concept of this issue. This is the best way to execute the same statement again and again. This is the best for finding the factorial of the number. Most of the time, recursion will be useful for the finding factorial as well as finding the postfix of the statement. Then use this concept as properly in your programming language.

  5. #5
    Join Date
    May 2009
    Posts
    543

    Re: Iteration and recursion in C++ language

    In the C++ programming language, the repeating code of the program will be follow using the recursion. If you wish to do the nested loop, then recursion is to be helped to do this task. It's very simple to do a nested loops recursion. The recursive method specially designed for this task and the iteration is an alternative way to do this task. This is best way to do such kind of complicated task. At compile time, compiler will decide the number of iteration of this code.

Similar Threads

  1. Replies: 8
    Last Post: 19-04-2012, 08:12 PM
  2. Replies: 3
    Last Post: 31-01-2011, 11:57 PM
  3. How to Disable Recursion on the DNS Server
    By Aliki in forum Networking & Security
    Replies: 5
    Last Post: 12-12-2010, 07:36 PM
  4. Iteration over a hashmap
    By New ID in forum Software Development
    Replies: 5
    Last Post: 07-02-2010, 03:40 AM
  5. Recursion in java
    By Xmen in forum Software Development
    Replies: 2
    Last Post: 19-11-2009, 01:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,660,231.67960 seconds with 17 queries