My question is: I have a certain amount of money, say 552. I want to break it down in my coins / accounts => Thus, the result will be, for example, 1x 500 1x 50 1x 2
I made 2 arrays for this:
double[] CoinValue = {500, 200, 100, 50, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05, 0.02, 0.01};
uint[] CoinAmount = new uint[CoinValue.Length];
My problem is exactly how to βtellβ the array the value 500 should be equal to 1 in the countAmount array. => 1. So, if I have 1000, the array array CoinAmount will know that it will need to hold 2 as a value (2x500 = 1000).
Thus, my end result will be something like this that gives the number of coins / bills: 1 x 500 1 x 50 1 x 2 .......
Thanks in advance.
source
share