Wow, wow, wow!!!!!!!!!!!!
I feel like in the 'inquisition' here; It seems that ppl here like to call evil to everything...
First off: Recursion is not a feature of C++!!!!
Recursion, in mathematics and computer science, is a method of defining functions in which the function being defined is applied within its own definition; specifically it is defining an infinite statement using finite components. The term is also used more generally to describe a process of repeating objects in a self-similar way. For instance, when the surfaces of two mirrors are exactly parallel with each other the nested images that occur are a form of infinite recursion.
- The thing with system("pause"); for one thing is that it's not part of your programme and it's a "feature" of the operating system... using that is not a good idea from your programme.... Those "feature" to call it a name would have been created private in modern days, so no everyone mess with it!!!
If u wanna keep the window open, try this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
//: Usage: Keep_Window_Open keep; in main funtion, so when main terminates "without any exceptions" it'll assure u not to close the console window....
class Keep_Window_Open
{
public:
~ Keep_Window_Open()
{
char c(0);
std::cout << "Press any key to EXIT!!!" << std::endl;
while( std::cin >> c && c != '\n') continue;
}
};
|
Return main() is just pointless... see main as the driver of your programme; It's what executes your code and it's called by the operating system and from within it it returns control to it....
"If I may be so brash, it has been my humble experience that there are two things traditionally taught in universities as a part of a computer science curriculum which many people just never really fully comprehend: pointers and recursion". Joel Spolsky; "The Perils of JavaSchools.