Ok, here is the problem. You are at a restaurant with a number of your friends, and the bill comes. But you have a 5, and two 10s. But your bill is 17. And your friend has 2 ones, and a 20. And another friend has three 10s. You need to split the bill–you want everyone to pay for their share, but find a way to redistribute the money without getting change. It’s a tricky problem–what if he gives two dollars to her, and then she gives a five to him…etc.
Can you write a program that splits the bill?
More specifically, can you write a program that given a list of people, where a person has an amount that they owe and a list of bills that they have, outputs whether or not it is possible to split the bill? Can you write one that shows exactly where the money needs to go?
To start off:
you have a vector
a person has a name, list of bills, and total amount owed
write:
bool SplitTheBill(people);