>>I was trying to think of a way to short circuit the loops once the sum of a group of numbers exceeds the target value...
>
>Don't know the practical side of the problem, but this reminds me of almost the same problem which we tried to solve (well, at least as a mental experiment) thirteen years ago: the customer was a poultry slaughterhouse (but they omitted the "poultry" when answering the phone :). There was a packing line, where a bunch of individually packed chicken would hang, ready to be dropped into a carton. The given data are: the weight of each of the chickens, the target weight of the carton, and the allowable error. Usually the carton would hold 20kg, and the error margin was +/- 50g.
>
Interesting...
>We never really solved any of these.
If those chicken's haven't fallen into boxes by now, they're probably spoiled :)
Steve Gibson