From 7d98b664c9e459a08f2e6e6fa5b636686dfed554 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 8 Apr 2026 10:42:51 +0300 Subject: feat(Week08): Add solutions --- Week08/Exercise01/Rocket.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Week08/Exercise01/Rocket.h (limited to 'Week08/Exercise01/Rocket.h') diff --git a/Week08/Exercise01/Rocket.h b/Week08/Exercise01/Rocket.h new file mode 100644 index 0000000..90ab2c7 --- /dev/null +++ b/Week08/Exercise01/Rocket.h @@ -0,0 +1,39 @@ +#ifndef _ROCKET +#define _ROCKET + +#include "RocketStage.h" +#include + +class Rocket { + char name[512]; + RocketStage* stages; + unsigned stagesCount; + unsigned stagesAlloc; + + void free(); + void copyFrom(const Rocket& other); + + void resize(); + +public: + Rocket(); + ~Rocket(); + Rocket(const Rocket& other); + Rocket& operator=(const Rocket& other); + Rocket(Rocket&& other); + Rocket& operator=(Rocket&& other); + + void SetName(const char* name); + void AddStage(const RocketStage& stage); + + double TotalWeight() const; + unsigned TotalHeight() const; + double FinalStageSpeed() const; + double TotalDistanceTravel() const; + unsigned TotalBurnTime() const; + + void Export(std::ofstream& outFile) const; + void Import(std::ifstream& inFile); +}; + +#endif /* _ROCKET */ -- cgit v1.3.1-26-gf316