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/Exercise6.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 week07/Exercise6.h (limited to 'week07/Exercise6.h') diff --git a/week07/Exercise6.h b/week07/Exercise6.h new file mode 100644 index 0000000..ab5df9e --- /dev/null +++ b/week07/Exercise6.h @@ -0,0 +1,27 @@ +#include + +class Matrix { + int values[4]; + + void addBy(int amount); + +public: + Matrix(int a, int b, int c, int d); + + Matrix& operator++(); + Matrix operator++(int); + Matrix& operator--(); + Matrix operator--(int); + + Matrix& operator+=(const Matrix& rhs); + Matrix& operator-=(const Matrix& rhs); + Matrix& operator*=(const Matrix& rhs); + + friend Matrix operator+(const Matrix& lhs, const Matrix& rhs); + friend Matrix operator-(const Matrix& lhs, const Matrix& rhs); + friend Matrix operator*(const Matrix& lhs, const Matrix& rhs); + + friend std::ostream& operator<<(std::ostream& lhs, const Matrix& rhs); + friend std::istream& operator>>(std::istream& lhs, Matrix& rhs); +}; + -- cgit v1.2.3