Coding Problem : Outputs the minimum amount of currency denominations

As you know I’ve been brushing up on my algorithm problem solving. I’ve decided to switch gears a bit and get back into C++ rather than Java. I found this problem by¬†Serge Lansiquot from his Udemy course called¬†Learn C++ Programming by Making Games. I highly recommend you pick up this series if you want a fun an easy way of understanding some fundamental computer science.

Write a program that takes a a floating point number and outputs the minimum amount of currency denominations needed to make up that number. Eg. If the user input 45.78 then the output would be:

4 ten dollar bills
1 five dollar bills
0 two dollar bills
0 one dollar bills
3 twenty five cent pieces
0 ten cent pieces
0 five cent pieces
3 one cent pieces

I’ll be updating this post with my solution via a short screencast in the next day or so. I’d love for you guys to post your solutions in the comments below. Please feel free to link me to a github gist or a screencast of your own or if you want to keep it simple and snap a screenshot and post that.