From a2e284b0056075e2365deaa2455be567c3b3c945 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 4 Apr 2024 20:11:12 +0300 Subject: [w7] Added exercise descriptions and solutions --- week07/Exercise1.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 week07/Exercise1.h (limited to 'week07/Exercise1.h') diff --git a/week07/Exercise1.h b/week07/Exercise1.h new file mode 100644 index 0000000..6de1a09 --- /dev/null +++ b/week07/Exercise1.h @@ -0,0 +1,25 @@ +struct Ingredient { + char name[512]; + float amount; +}; + +class Recipe { + Ingredient* ingredients; + unsigned lastIndex; + unsigned allocated; + + void resize(); + void free(); + void copyFrom(const Recipe& other); + +public: + Recipe(); + ~Recipe(); + Recipe(const Recipe& other); + Recipe& operator=(const Recipe& other); + Recipe(Recipe&& other); + Recipe& operator=(Recipe&& other); + + void AddIngredient(const Ingredient& newIng); + void RemoveIngredient(const char* name); +}; -- cgit v1.2.3