TowersAlex
❔ (Beginner) Seeking Advice on Distributing Items Equally in C# Program
Hey everyone! I hope you're doing well. I'm still pretty new around here and not exactly a pro in the world of C#, but I love programming in my spare time. A few weeks back, I started with C# and now I'm working on this project for an app.
I'm tinkering with a program that evenly distributes different things (like 3 tomatoes, 4 bananas, and 6 apples) among a set number of bags (let's say 3 bags). The total count of each type of fruit and the overall count of items shouldn't differ by more than one, so it's as fair as possible for each bag.
My approach is to create a list of integer arrays, which I'd call 'bags.' Each part of this list would hold an integer array where the items for each bag would go. Do you see where I'm going with this? I could really use your help and would appreciate your thoughts on how best to proceed. Should I divide the count of items or what would be your approach? Looking forward to your suggestions! Thanks in advance.
8 replies