Since addition is not even associative in floating point arithmetic, your problem is not well defined...
(Well it might be well defined, see update 2, but some naive expectations might be a cause of surprise)
If you have (x+y) + z == sum, there is not much guaranty that x + (y+z) == sum
For example, say you want to split 0.31 in 3 IEEE 754 double precision, 0.10, 0.10 and 0.11
Here is sum computed back (the shortest decimal fraction that would round to the same float as the sum)
0.10+0.10+0.11 == 0.31
0.11+0.10+0.10 == 0.31000000000000005
These two numbers are very close, but not the same, and no one is really equal to 31/100 but well...
In the second form, you could do a slight correction:
0.10999999999999999 + 0.10 + 0.10 == 0.31
That means that depending on the order you use to sum back, results shall differ...
So what do you expect exactly from floating point?
Of course, you could just ignore those tiny differences and continue using floating point to do the necessary quotient/remainder operations if you are sure that rounding errors will never accumulate dangerously; it's possible to use float but you should then question each and every naive expectation and it can get tricky. My advice would be to simply use integer arithmetic as others suggested.
UPDATE
After reading the link Rounding floats so that they sum to precisely 1 from PascalCuoq, I realized that 0.10999999999999999 is in all case a better solution than 0.11 because it's 0.31-(0.31-0.11), and because 0.31-(0.31-0.1)==0.1. Thanks PascalCuoq!
UPDATE 2
The non associativity is essential because it implies that two different naive implementations will lead to different results.
However, as underlined by tmyklebu, the exact sum is well defined, though not easily accessible in C/C++.
In above example, the exact sum of nearest double to 10/100 , 10/100 , 11/100 slightly excess the nearest double to 31/100, so we have to adjust one of the operands down by an ulp. This is what makes floating point usage arguable more than the single property of associativity.
This can be illustrated if we try to fairly distribute the double amount=0.30 in 3 double: because the nearest double to 30/100 is exactly 5404319552844595/18014398509481984, and since the numerator is not divisible by 3 (the remainder is 1), then it cannot be split in 3 equal doubles. The quotient of 5404319552844595/3 divided by 18014398509481984 will lead to the predecessor of 0.1, and we have to adjust one operand by increasing with an ulp. Naive sum hereunder matches exact sum:
0.09999999999999999+0.09999999999999999+0.1 == 0.3
This is another form of the very well known (at least on SO) 0.1+0.1+0.1 != 0.3