Knowing the bill before the waiter

#include <iostream> #include <vector> using namespace std; struct Item { string name; double price; }; class Person { public: vector<Item> items; void add_items(vector<Item> its) { items = its; }; }; class FamilyDinner { private: vector<Person> people; double total_price = 0; public: void add_people(vector<Person> p) {people = p;} double calculate_price() { for(const Person p : people) { for(const Item item: p.items) { total_price += item.price; } } return total_price; } }; int main() { FamilyDinner dinner; Person me, mother, father, brother, sister; vector<Item> me_items = { {"Green salad", 7.80}, {"Pommes frittes", 5.40}, {"Caberne Souvignon", 9.40}, }, mother_items = { {"Lasagne", 11.80}, {"Merlot", 9.40}, {"Apfelstrudel", 7.80}, }, father_items = { {"Tortilla", 10.40}, {"Caberne Souvignon", 9.40}, {"Coconut cake", 12.10} }, brother_items = { {"Cheeseburger", 5.70}, {"Pizza Capricciosa (small)", 6.40}, {"Merlot", 8.60}, }, sister_items = { {"Green salad", 7.80}, {"Pizza Quatro Formaggi (big)", 9.60}, {"Ananas juice", 7.60}, {"Boss Ice cream", 7.20}, }; me.add_items(me_items); mother.add_items(mother_items); father.add_items(father_items); brother.add_items(brother_items); sister.add_items(sister_items); dinner.add_people(vector<Person> {me, mother, father, brother, sister}); cout << "Total price: " << dinner.calculate_price() << "$" << endl; // Total price: 136.4$ return 0; }