From b38346eebca9a007971af02fb3bb9472c5e16d0c Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 26 Apr 2026 21:43:31 +0300 Subject: feat(Week09): Add solutions --- Week09/Exercise01/Locomotive.h | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Week09/Exercise01/Locomotive.h (limited to 'Week09/Exercise01/Locomotive.h') diff --git a/Week09/Exercise01/Locomotive.h b/Week09/Exercise01/Locomotive.h new file mode 100644 index 0000000..45e9f7b --- /dev/null +++ b/Week09/Exercise01/Locomotive.h @@ -0,0 +1,43 @@ +#ifndef _LOCOMOTIVE +#define _LOCOMOTIVE + +#include + +const unsigned MAX_LEN = 1024; + +class Locomotive { + unsigned ID; + char manufacturer[MAX_LEN]; + char model[MAX_LEN]; + int yearOfManufacture; + double length; + unsigned short cyllinders; + bool supportsMultipleWorking; + +public: + unsigned GetID() const; + void SetID(unsigned ID); + + const char* GetManufacturer() const; + void SetManufacturer(const char manufacturer[MAX_LEN]); + + const char* GetModel() const; + void SetModel(const char model[MAX_LEN]); + + int GetYearOfManufacture() const; + void SetYearOfManufacture(int yearOfManufacture); + + double GetLength() const; + void SetLength(double length); + + unsigned short GetCyllinders() const; + void SetCyllinders(unsigned short cyllinders); + + bool GetSupportsMultipleWorking() const; + void SetSupportsMultipleWorking(bool supportsMultipleWorking); + + friend std::ofstream& operator<<(std::ofstream& ostr, const Locomotive& loc); + friend std::ifstream& operator>>(std::ifstream& istr, Locomotive& loc); +}; + +#endif /* _LOCOMOTIVE */ -- cgit v1.3.1-26-gb76a