-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
71 lines (56 loc) · 957 Bytes
/
Main.cpp
File metadata and controls
71 lines (56 loc) · 957 Bytes
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
//yoav1.nach@gmail.com
#include "SquareMat.h"
using namespace Matrix;
int main()
{
double** mat = new double*[3];
int n = 1;
for (int i = 0; i < 3; i++)
{
mat[i] = new double[3];
for (int j = 0; j < 3; j++)
{
mat[i][j] = n;
n++;
}
}
double** mat2 = new double* [3];
for (int i = 0; i < 3; i++)
{
mat2[i] = new double[3];
for (int j = 0; j < 3; j++)
{
mat2[i][j] = n;
n++;
}
}
SquareMat s = SquareMat(3, mat);
SquareMat s2 = SquareMat(3, mat2);
s.printMat();
s2.printMat();
SquareMat s3 = s + s2;
s3.printMat();
s3 = s2 - s;
s3.printMat();
s3 = s2 * s;
s3.printMat();
s3 = s * 2;
s3.printMat();
s3 = 2 * s;
s3.printMat();
s3 = s % s2;
s3.printMat();
~s3;
s3.printMat();
cout << s3[0][0] << endl << endl;
cout << s3[2][1] << endl << endl;
cout << !s3<<endl<<endl;
cout << s3;
for (int i = 0; i < 3; i++)
{
delete[] mat[i];
delete[] mat2[i];
}
delete[] mat;
delete[]mat2;
}