All i get as output is the initialized userNumber value.
I have stepped through the program and oddly enough it looks
like it starts at zero and then simply counts up to userNumber.
I have overloaded recursion with a Factorials::recursion(); declaration but I have tested to see if there was interference there and everything seems with cool with the overloaded functions.
I have stepped through the program and oddly enough it looks
like it starts at zero and then simply counts up to userNumber.
The way that it is codded, if you are putting a break point on the return line, then I would expect it not to break until it hits the end of the recursion (userNumber = 0), then you would step back up the stack. If you are watching userNumber, it will appear as you have described.
Is the returned value correct?
Also you should guard against a negative userNumber
helios: I've renamed the function to get rid of overload and still have the same problem.
Grey Wolf: negative numbers guarded against in the input function, am I missing something or wouldn't it return values starting at userNumber and then count down vs what its doing by starting at zero and counting up to userNumber? It only returns the userNumber, not the recursion of the userNumber.