From 66dae7d866dd095ebd355ea4aa6bddae74e25ab2 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Sat, 28 Dec 2024 22:29:03 +0500 Subject: [PATCH 01/21] Update matrix.cpp --- task1/matrix.cpp | 87 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 78 insertions(+), 9 deletions(-) diff --git a/task1/matrix.cpp b/task1/matrix.cpp index fb3598f..e386c76 100644 --- a/task1/matrix.cpp +++ b/task1/matrix.cpp @@ -4,45 +4,114 @@ Matrix::Matrix(int numRows, int numCols) { - // your implementation here + if (numRows < 0 || numCols < 0) { + throw out_of_range(""); + } + if (numRows == 0 || numCols == 0) { + x = 0; + y = 0; + Z.clear(); + } + else { + x = numRows; + y = numCols; + Z.assign(x, vector(y, 0)); + } } void Matrix::Reset(int numRows, int numCols) { - // your implementation here + if (numRows < 0 || numCols < 0) + { + throw out_of_range(""); + } + if (numRows == 0 || numCols == 0) + { + x = 0; + y = 0; + Z.clear(); + } + else + { + x = numRows; + y = numCols; + Z.assign(x, vector(y, 0)); + } } int& Matrix::At(int row, int col) { - // your implementation here + if (row < 0 || row >= x || col < 0 || col >= y) + { + throw out_of_range(""); + } + return Z[row][col]; } const int& Matrix::At(int row, int col) const { - // your implementation here + if (row < 0 || row >= x || col < 0 || col >= y) + { + throw out_of_range(""); + } + return Z[row][col]; } int Matrix::GetRows() const { - // your implementation here + return x; } int Matrix::GetCols() const { - // your implementation here + return y; } bool Matrix::operator==(const Matrix& m2) { - // your implementation here + if (x!=m2.GetRows() || y != m2.GetCols()) + { + return false; + } + else + { + int i = 0, j=0; + bool b = true; + for (i; i < x; ++i) + { + for (j; j < y; ++j) + { + if (Z[i][j] != m2.At(i, j)) + { + b = false; + break; + } + } + } + return b; + } } bool Matrix::operator!=(const Matrix& m2) { - // your implementation here + return not(this->operator==(m2)); } Matrix Matrix::operator+(const Matrix& m2) { - // your implementation here + if (x == m2.GetRows() && y == m2.GetCols()) + { + int i = 0, j = 0; + for (i; i < x; ++i) + { + for (j; j < y; ++j) + { + Z[i][j] += m2.At(i, j); + } + }; + } + else + { + throw invalid_argument(""); + } } From ded81e2775ddcbf8dc3a0fb7bc4bc7c687bc6379 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Sat, 28 Dec 2024 22:38:55 +0500 Subject: [PATCH 02/21] Update matrix.hpp --- task1/matrix.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/task1/matrix.hpp b/task1/matrix.hpp index d314915..704a259 100644 --- a/task1/matrix.hpp +++ b/task1/matrix.hpp @@ -2,6 +2,9 @@ class Matrix { +private: + int x, y; + vector> Z; public: Matrix() = default; Matrix(int numRows, int numCols); From b69203e6c777b113859d10c53f99af3bbf4b1019 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Sat, 28 Dec 2024 22:54:47 +0500 Subject: [PATCH 03/21] Update matrix.cpp --- task1/matrix.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/task1/matrix.cpp b/task1/matrix.cpp index e386c76..0046106 100644 --- a/task1/matrix.cpp +++ b/task1/matrix.cpp @@ -115,3 +115,27 @@ Matrix Matrix::operator+(const Matrix& m2) throw invalid_argument(""); } } + +istream& operator>>(istream& in, Matrix& M) +{ + int x, y; + in >> x >> y; + M.Reset(x, y); + for (int i = 0; i < x; ++i) { + for (int j = 0; j < y; ++j) { + in >> M.At(i, j); + } + } + return in; +} + +ostream& operator<<(ostream& out, const Matrix& M) { + out << M.GetRows() << " " << M.GetCols() << "\n"; + for (int i = 0; i < M.GetRows(); ++i) { + for (int j = 0; j < M.GetCols(); ++j) { + out << M.At(i, j) << " "; + } + out << "\n"; + } + return out; +} From d0b43971ba79ce362f04dcb5b9fc2f7ff43a4266 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Sat, 28 Dec 2024 23:49:52 +0500 Subject: [PATCH 04/21] Update matrix.cpp --- task1/matrix.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/task1/matrix.cpp b/task1/matrix.cpp index 0046106..f57675f 100644 --- a/task1/matrix.cpp +++ b/task1/matrix.cpp @@ -99,22 +99,23 @@ bool Matrix::operator!=(const Matrix& m2) Matrix Matrix::operator+(const Matrix& m2) { - if (x == m2.GetRows() && y == m2.GetCols()) - { - int i = 0, j = 0; - for (i; i < x; ++i) + if (x != m2.GetRows() || y != m2.GetCols()) { - for (j; j < y; ++j) + throw invalid_argument(""); + } + else + { + Matrix S(x, y); + for (int i = 0; i < x; ++i) { - Z[i][j] += m2.At(i, j); + for (int j = 0; j < y; ++j) + { + S.At(i, j) = Z[i][j] + m2.At(i, j); + } } - }; - } - else - { - throw invalid_argument(""); + return res; + } } -} istream& operator>>(istream& in, Matrix& M) { From c5c5b297db771e43b18962d0b2d0fa072961ee9d Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Sun, 29 Dec 2024 02:47:06 +0500 Subject: [PATCH 05/21] Update figures.hpp --- task2/figures.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/task2/figures.hpp b/task2/figures.hpp index 65a6110..c3f0358 100644 --- a/task2/figures.hpp +++ b/task2/figures.hpp @@ -19,14 +19,35 @@ class Figure { class Rect : public Figure { +private: + double l,h; +public: + Rect(double l, double h); + FigureType Type() const; + double Perimeter() const; + double Area() const; }; class Triangle : public Figure { +private: + double a,b,c; +public: + Rect(double a, double b, double c); + FigureType Type() const; + double Perimeter() const; + double Area() const; }; class Circle : public Figure { +private: + double r; +public: + Rect(double r); + FigureType Type() const; + double Perimeter() const; + double Area() const; }; std::unique_ptr
make_figure(FigureType type, double a, double b = 0, double c = 0); From d859dee80c94fab845adeac087422810c0e11898 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Sun, 29 Dec 2024 03:22:33 +0500 Subject: [PATCH 06/21] Update figures.hpp --- task2/figures.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/task2/figures.hpp b/task2/figures.hpp index c3f0358..cd2b97e 100644 --- a/task2/figures.hpp +++ b/task2/figures.hpp @@ -52,11 +52,15 @@ class Circle : public Figure std::unique_ptr
make_figure(FigureType type, double a, double b = 0, double c = 0); -class WrongTriangle : public std::invalid_argument +class WrongTriangle : public invalid_argument { +public: + WrongTriangle(const char* a) : invalid_argument(a) {} }; -class LessThanZeroParam : public std::invalid_argument +class LessThanZeroParam : public invalid_argument { +public: + LessThanZeroParam(const char* a) : invalid_argument(a) {} }; From 31a4032cbc3c3d7c4880fcb90915acffaef57aba Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Sun, 29 Dec 2024 03:25:07 +0500 Subject: [PATCH 07/21] Update figures.cpp --- task2/figures.cpp | 99 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) diff --git a/task2/figures.cpp b/task2/figures.cpp index 3b33880..6f61382 100644 --- a/task2/figures.cpp +++ b/task2/figures.cpp @@ -1,3 +1,100 @@ #include "figures.hpp" - +#include +#include +using namespace std; static constexpr double PI = 3.14; + +class Rect : public Figure +{ +public: + Rect(double l, double h) + { + this->l = l; + this->h = h; + } + FigureType Type() const + { + return FigureType::RECTANGLE; + } + double Perimeter() const + { + return 2*h+l*2 + } + double Area() const + { + return h * l; + } +}; + +class Triangle : public Figure +{ +public: + Triangle(double a, double b, double c) + { + this->a = a; + this->b = b; + this->c = c; + } + FigureType Type() const + { + return FigureType::TRIANGLE; + } + double Perimeter() const + { + return a + b + c; + } + double Area() const + { + double p = Perimeter() / 2; + return sqrt(p * (p - a) * (p - b) * (p - c)); + } +}; + +class Circle : public Figure +{ +public: + Circle(double r) + { + this->r = r; + } + FigureType Type() const + { + return FigureType::CIRCLE; + } + double Perimeter() const + { + return 2 * PI * r; + } + double Area() const + { + return PI * r * r; + } +}; + +unique_ptr
make_figure(FigureType type, double a, double b, double c) +{ + if (a < 0 || b < 0 || c < 0) + { + throw LessThanZeroParam(""); + } + if (type == FigureType::RECTANGLE) + { + return make_unique(a, b); + } + else if (type == FigureType::CIRCLE) + { + return make_unique(a); + } + else if (type == FigureType::TRIANGLE) + { + if (a + b <= c || a + c <= b || b + c <= a) + { + throw WrongTriangle(""); + } + return make_unique(a, b, c); + } + else + { + return nullptr; + } +} From f782a2a7122a7667aa0f12153424b5338c75e528 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Sun, 29 Dec 2024 03:30:45 +0500 Subject: [PATCH 08/21] Update figures.hpp --- task2/figures.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/task2/figures.hpp b/task2/figures.hpp index cd2b97e..6bad94f 100644 --- a/task2/figures.hpp +++ b/task2/figures.hpp @@ -55,12 +55,12 @@ std::unique_ptr
make_figure(FigureType type, double a, double b = 0, dou class WrongTriangle : public invalid_argument { public: - WrongTriangle(const char* a) : invalid_argument(a) {} + using std::invalid_argument::invalid_argument; }; class LessThanZeroParam : public invalid_argument { public: - LessThanZeroParam(const char* a) : invalid_argument(a) {} + using std::invalid_argument::invalid_argument; }; From d8422b46ca266008eb89f5ea73fe0305d376faf8 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Mon, 30 Dec 2024 07:54:00 +0500 Subject: [PATCH 09/21] Update circular_queue.cpp --- task3/circular_queue.cpp | 65 +++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 7 deletions(-) diff --git a/task3/circular_queue.cpp b/task3/circular_queue.cpp index fa74734..48f2ff9 100644 --- a/task3/circular_queue.cpp +++ b/task3/circular_queue.cpp @@ -2,35 +2,86 @@ CircularQueue::CircularQueue(size_t size) { - // your implementation here + V.resize(size); } bool CircularQueue::Push(int value) { - // your implementation here + if (Full()) + { + return false; + } + else + { + if (s == -1) s = 0; + e = (e + 1) % V.size(); + V[e] = value; + return true; + } } bool CircularQueue::Pop() { - // your implementation here + if (Empty()) + { + return false; + } + else + { + if (s == e) + { + s = -1; + e = -1; + } + else + { + s = (s + 1) % V.size(); + } + return true; + } } int CircularQueue::Front() const { - // your implementation here + if (Empty()) + { + return -1; + } + else + { + return V[s]; + } } int CircularQueue::Back() const { - // your implementation here + if (Empty()) + { + return -1; + } + else + { + return V[e]; + } } bool CircularQueue::Empty() const { - // your implementation here + if (s == -1) + return true; + else + return false; } bool CircularQueue::Full() const { - // your implementation here + if (s == 0 && e == V.size() - 1) + { + return true; + } + if (s == (e + 1) % V.size()) + { + return true; + } + return false; } From 54bb62d7ed939d59c305dffa16cfc58caecbba74 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Mon, 30 Dec 2024 07:55:02 +0500 Subject: [PATCH 10/21] Update circular_queue.hpp --- task3/circular_queue.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/task3/circular_queue.hpp b/task3/circular_queue.hpp index 2871091..1063b30 100644 --- a/task3/circular_queue.hpp +++ b/task3/circular_queue.hpp @@ -3,6 +3,9 @@ #include class CircularQueue { +private: + vector V; + int s = -1, e = -1; public: CircularQueue(size_t size); // создать очередь с определенным размером буффера bool Push(int value); // добавить значение в конец очереди (false, если очередь заполнена) From 4e53dead453ca4fc58efc8e34f6e99aabd0c88d1 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Fri, 10 Jan 2025 20:36:36 +0500 Subject: [PATCH 11/21] Update matrix.hpp --- task1/matrix.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/task1/matrix.hpp b/task1/matrix.hpp index 704a259..af223be 100644 --- a/task1/matrix.hpp +++ b/task1/matrix.hpp @@ -1,5 +1,6 @@ #pragma once - +#include +using namespace std; class Matrix { private: @@ -18,4 +19,7 @@ class Matrix bool operator==(const Matrix& m2); bool operator!=(const Matrix& m2); Matrix operator+(const Matrix& m2); + + istream& operator>>(istream& in, Matrix& M) + ostream& operator<<(ostream& out, const Matrix& M) }; From 64ecf853d325ea36933eb730bb5683a877a9577a Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Fri, 10 Jan 2025 20:36:44 +0500 Subject: [PATCH 12/21] Update matrix.cpp --- task1/matrix.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/task1/matrix.cpp b/task1/matrix.cpp index f57675f..dd3e364 100644 --- a/task1/matrix.cpp +++ b/task1/matrix.cpp @@ -1,18 +1,22 @@ #include "matrix.hpp" - +#include +using namespace std; #include Matrix::Matrix(int numRows, int numCols) { - if (numRows < 0 || numCols < 0) { + if (numRows < 0 || numCols < 0) + { throw out_of_range(""); } - if (numRows == 0 || numCols == 0) { + if (numRows == 0 || numCols == 0) + { x = 0; y = 0; Z.clear(); } - else { + else + { x = numRows; y = numCols; Z.assign(x, vector(y, 0)); @@ -75,11 +79,10 @@ bool Matrix::operator==(const Matrix& m2) } else { - int i = 0, j=0; bool b = true; - for (i; i < x; ++i) + for (int i=0; i < x; ++i) { - for (j; j < y; ++j) + for (int j=0; j < y; ++j) { if (Z[i][j] != m2.At(i, j)) { @@ -113,7 +116,7 @@ Matrix Matrix::operator+(const Matrix& m2) S.At(i, j) = Z[i][j] + m2.At(i, j); } } - return res; + return S; } } @@ -130,7 +133,8 @@ istream& operator>>(istream& in, Matrix& M) return in; } -ostream& operator<<(ostream& out, const Matrix& M) { +ostream& operator<<(ostream& out, const Matrix& M) +{ out << M.GetRows() << " " << M.GetCols() << "\n"; for (int i = 0; i < M.GetRows(); ++i) { for (int j = 0; j < M.GetCols(); ++j) { From f5585064a23190f578600ae06b3fe9fd89df5f8c Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Fri, 10 Jan 2025 22:41:33 +0500 Subject: [PATCH 13/21] Update figures.hpp --- task2/figures.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/task2/figures.hpp b/task2/figures.hpp index 6bad94f..3327054 100644 --- a/task2/figures.hpp +++ b/task2/figures.hpp @@ -33,7 +33,7 @@ class Triangle : public Figure private: double a,b,c; public: - Rect(double a, double b, double c); + Triangle(double a, double b, double c); FigureType Type() const; double Perimeter() const; double Area() const; @@ -44,7 +44,7 @@ class Circle : public Figure private: double r; public: - Rect(double r); + Circle(double r); FigureType Type() const; double Perimeter() const; double Area() const; @@ -55,12 +55,12 @@ std::unique_ptr
make_figure(FigureType type, double a, double b = 0, dou class WrongTriangle : public invalid_argument { public: - using std::invalid_argument::invalid_argument; + WrongTriangle() : std::invalid_argument("") {} }; class LessThanZeroParam : public invalid_argument { public: - using std::invalid_argument::invalid_argument; + LessThanZeroParam() : std::invalid_argument("") {} }; From 761fbbbcdf39fbc3e3626e443f9de0517374432e Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Fri, 10 Jan 2025 22:41:40 +0500 Subject: [PATCH 14/21] Update figures.cpp --- task2/figures.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/task2/figures.cpp b/task2/figures.cpp index 6f61382..6132090 100644 --- a/task2/figures.cpp +++ b/task2/figures.cpp @@ -11,6 +11,10 @@ class Rect : public Figure { this->l = l; this->h = h; + if (l < 0 || h < 0) + { + throw LessThanZeroParam(""); + } } FigureType Type() const { @@ -34,6 +38,14 @@ class Triangle : public Figure this->a = a; this->b = b; this->c = c; + if (a < 0 || b < 0 || c < 0) + { + throw LessThanZeroParam(""); + } + if (a + b <= c || a + c <= b || b + c <= a) + { + throw WrongTriangle(""); + } } FigureType Type() const { @@ -56,6 +68,10 @@ class Circle : public Figure Circle(double r) { this->r = r; + if (r < 0) + { + throw LessThanZeroParam(""); + } } FigureType Type() const { From a8a2f0de1a7dc61f2e394f17dca3bf660fd4f41c Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Fri, 10 Jan 2025 22:53:54 +0500 Subject: [PATCH 15/21] Update circular_queue.cpp --- task3/circular_queue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/task3/circular_queue.cpp b/task3/circular_queue.cpp index 48f2ff9..3feddde 100644 --- a/task3/circular_queue.cpp +++ b/task3/circular_queue.cpp @@ -1,6 +1,6 @@ #include "circular_queue.hpp" - -CircularQueue::CircularQueue(size_t size) +#include +CircularQueue::CircularQueue(int size) { V.resize(size); } From 25504b82a461901df45982fc3e15afde608c3ce7 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Fri, 10 Jan 2025 22:54:01 +0500 Subject: [PATCH 16/21] Update circular_queue.hpp --- task3/circular_queue.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/task3/circular_queue.hpp b/task3/circular_queue.hpp index 1063b30..e389609 100644 --- a/task3/circular_queue.hpp +++ b/task3/circular_queue.hpp @@ -1,5 +1,5 @@ #pragma once - +#include #include class CircularQueue { From 8d7856dfc53a4d97c2550ea16b038a5d2cf93148 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Wed, 15 Jan 2025 22:39:24 +0500 Subject: [PATCH 17/21] Update matrix.hpp --- task1/matrix.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/task1/matrix.hpp b/task1/matrix.hpp index af223be..09ba05e 100644 --- a/task1/matrix.hpp +++ b/task1/matrix.hpp @@ -20,6 +20,6 @@ class Matrix bool operator!=(const Matrix& m2); Matrix operator+(const Matrix& m2); - istream& operator>>(istream& in, Matrix& M) - ostream& operator<<(ostream& out, const Matrix& M) + friend istream& operator>>(istream& in, Matrix& M) + friend ostream& operator<<(ostream& out, const Matrix& M) }; From 3c50dfddb01b46102f69b0e36abeb7273c1dd091 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Wed, 15 Jan 2025 23:01:45 +0500 Subject: [PATCH 18/21] Update matrix.cpp --- task1/matrix.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/task1/matrix.cpp b/task1/matrix.cpp index dd3e364..f026386 100644 --- a/task1/matrix.cpp +++ b/task1/matrix.cpp @@ -7,7 +7,7 @@ Matrix::Matrix(int numRows, int numCols) { if (numRows < 0 || numCols < 0) { - throw out_of_range(""); + throw std::out_of_range(""); } if (numRows == 0 || numCols == 0) { @@ -27,7 +27,7 @@ void Matrix::Reset(int numRows, int numCols) { if (numRows < 0 || numCols < 0) { - throw out_of_range(""); + throw std::out_of_range(""); } if (numRows == 0 || numCols == 0) { @@ -47,7 +47,7 @@ int& Matrix::At(int row, int col) { if (row < 0 || row >= x || col < 0 || col >= y) { - throw out_of_range(""); + throw std::out_of_range(""); } return Z[row][col]; } @@ -56,7 +56,7 @@ const int& Matrix::At(int row, int col) const { if (row < 0 || row >= x || col < 0 || col >= y) { - throw out_of_range(""); + throw std::out_of_range(""); } return Z[row][col]; } @@ -104,7 +104,7 @@ Matrix Matrix::operator+(const Matrix& m2) { if (x != m2.GetRows() || y != m2.GetCols()) { - throw invalid_argument(""); + throw std::invalid_argument(""); } else { @@ -120,7 +120,7 @@ Matrix Matrix::operator+(const Matrix& m2) } } -istream& operator>>(istream& in, Matrix& M) +std::istream& operator>>(std::istream& in, Matrix& M) { int x, y; in >> x >> y; @@ -133,7 +133,7 @@ istream& operator>>(istream& in, Matrix& M) return in; } -ostream& operator<<(ostream& out, const Matrix& M) +std::ostream& operator<<(std::ostream& out, const Matrix& M) { out << M.GetRows() << " " << M.GetCols() << "\n"; for (int i = 0; i < M.GetRows(); ++i) { From 3dbeefebbd9015a8019aa36e163dfa81cd92ceed Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Wed, 15 Jan 2025 23:19:26 +0500 Subject: [PATCH 19/21] Update figures.cpp --- task2/figures.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/task2/figures.cpp b/task2/figures.cpp index 6132090..3f86961 100644 --- a/task2/figures.cpp +++ b/task2/figures.cpp @@ -4,7 +4,7 @@ using namespace std; static constexpr double PI = 3.14; -class Rect : public Figure +class Rect { public: Rect(double l, double h) @@ -30,7 +30,7 @@ class Rect : public Figure } }; -class Triangle : public Figure +class Triangle { public: Triangle(double a, double b, double c) @@ -62,7 +62,7 @@ class Triangle : public Figure } }; -class Circle : public Figure +class Circle { public: Circle(double r) @@ -87,7 +87,7 @@ class Circle : public Figure } }; -unique_ptr
make_figure(FigureType type, double a, double b, double c) +std::unique_ptr
make_figure(FigureType type, double a, double b, double c) { if (a < 0 || b < 0 || c < 0) { @@ -95,11 +95,11 @@ unique_ptr
make_figure(FigureType type, double a, double b, double c) } if (type == FigureType::RECTANGLE) { - return make_unique(a, b); + return std::make_unique(a, b); } else if (type == FigureType::CIRCLE) { - return make_unique(a); + return std::make_unique(a); } else if (type == FigureType::TRIANGLE) { @@ -107,7 +107,7 @@ unique_ptr
make_figure(FigureType type, double a, double b, double c) { throw WrongTriangle(""); } - return make_unique(a, b, c); + return std::make_unique(a, b, c); } else { From 70802223890f271e17d054ffa2cea7cdd2947eb1 Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Wed, 15 Jan 2025 23:25:07 +0500 Subject: [PATCH 20/21] Update circular_queue.hpp --- task3/circular_queue.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/task3/circular_queue.hpp b/task3/circular_queue.hpp index e389609..ace1cf0 100644 --- a/task3/circular_queue.hpp +++ b/task3/circular_queue.hpp @@ -1,10 +1,8 @@ #pragma once -#include #include class CircularQueue { private: - vector V; int s = -1, e = -1; public: CircularQueue(size_t size); // создать очередь с определенным размером буффера From 93c7d80be462945add6b869addae9964edbe826e Mon Sep 17 00:00:00 2001 From: MAXmvp228 Date: Wed, 15 Jan 2025 23:27:12 +0500 Subject: [PATCH 21/21] Update circular_queue.cpp --- task3/circular_queue.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/task3/circular_queue.cpp b/task3/circular_queue.cpp index 3feddde..71dd559 100644 --- a/task3/circular_queue.cpp +++ b/task3/circular_queue.cpp @@ -1,8 +1,7 @@ #include "circular_queue.hpp" -#include CircularQueue::CircularQueue(int size) { - V.resize(size); + int V[size]; } bool CircularQueue::Push(int value)