Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 26-06-2011
Member
 
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.
Reply With Quote
  #2  
Old 26-06-2011
Member
 
Join Date: May 2009
Posts: 525
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.
Reply With Quote
  #3  
Old 26-06-2011
Member
 
Join Date: May 2009
Posts: 532
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);
Reply With Quote
  #4  
Old 26-06-2011
Member
 
Join Date: Apr 2009
Posts: 484
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.
Reply With Quote
  #5  
Old 27-06-2011
Member
 
Join Date: May 2009
Posts: 533
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Iteration and recursion in C++ language"
Thread Thread Starter Forum Replies Last Post
How to change ?Microsoft office 2011 for Mac? language as I bought the wrong language package Naq Windows Software 8 19-04-2012 08:12 PM
No Chinese language even after language pack upgrade in windows 7 Cadence Operating Systems 3 31-01-2011 11:57 PM
How to Disable Recursion on the DNS Server Aliki Networking & Security 5 12-12-2010 07:36 PM
Iteration over a hashmap New ID Software Development 5 07-02-2010 03:40 AM
Recursion in java Xmen Software Development 2 19-11-2009 01:41 PM


All times are GMT +5.5. The time now is 07:54 AM.