-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrix.h
More file actions
76 lines (63 loc) · 1.26 KB
/
Matrix.h
File metadata and controls
76 lines (63 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#pragma once
#include "Massive.h"
#include <iostream>
using namespace std;
class Matrix {
int** mx;
int m; // êîëè÷åñòâî ñòîëáöîâ
int n; // êîëè÷åñòâî ñòðîê
public:
Matrix(int m, int n) {
this->m = m;
this->n = n;
mx = new int* [m];
for (int i = 0; i < m; i++) {
mx[i] = new int[n];
for (int j = 0; j < n; j++) {
mx[i][j] = 0;
}
}
}
Matrix(int m, int n, int** mx) {
this->m = m;
this->n = n;
this->mx = new int* [m];
for (int i = 0; i < m; i++) {
this->mx[i] = new int[n];
for (int j = 0; j < n; j++) {
this->mx[i][j] = mx[i][j];
}
}
}
Matrix() : m(2), n(2) {
this->mx = new int* [2];
for (int i = 0; i < m; i++) {
this->mx[i] = new int[n];
for (int j = 0; j < n; j++) {
this->mx[i][j] = 0;
}
}
}
~Matrix() {
for (int i = 0; i < n; i++) {
delete this->mx[i];
}
delete mx;
}
Matrix(const Matrix& obj) {
this->m = obj.m;
this->n = obj.n;
//~Matrix(); // ðàçîáðàòüñÿ
mx = new int* [m];
for (int i = 0; i < m; i++) {
mx[i] = new int[n];
for (int j = 0; j < n; j++) {
mx[i][j] = obj.mx[i][j];
}
}
}
friend Massive& operator&(Matrix&, Matrix&);
int get_m();
int get_n();
int** get_mx();
};