How come you prompt the user for amount in pennies?
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
So all you need to do is find out how to most efficiently give change?
How do you determine what combination of coins and bills to use in a store? All you have to do is put that reasoning into code.
Say you give $1.26 in change.
How many dollars is that?
When those are gone, how many quarters are there in the leftover amount?
etc. etc. etc.
It's not hard.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
recursive function would be my choice. Far cleaner.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337