The key to recursion is defining a base case. Here the base case should be "making change for a penny?".
Take a look at this:
http://programmingexamples.net/index.php?title=CPP/recursion
and see if it points you in the right direction.
You'll probably need to define an array with the possible values of a coin:
int coins[5] = {50,25,10,5,1};
and then make the recursive function
MakeChange(unsigned int coinId)
David
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 204
Sure thing. It would be great if you could post your working code and then mark the thread as solved.
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 204