-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
65 lines (49 loc) · 1.71 KB
/
main.cpp
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
#include <iostream>
#include "problem-1/array.h"
#include "problem-1/array.cpp"
#include "problem-2/matrix.h"
#include "problem-2/matrix.cpp"
int main() {
int **x = new int *[3];
for (int i = 0; i < 3; i++) x[i] = new int[3];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
x[i][j] = (i + 1) * (j + 1);
}
}
matrix<int> a(x, 3, 3);
matrix<int> b(a);
array<int> c(x[0], 3);
std::cout << "\na=\n" << a << std::endl;
std::cout << "\nc=\n" << c << std::endl;
std::cout << "\nc+x[0]=\n" << c + x[0] << std::endl;
std::cout << "\nc-x[0]=\n" << c - x[0] << std::endl;
std::cout << "\nc*x[0]=\n" << c * x[0] << std::endl;
std::cout << "\nc/x[0]=\n" << c / x[0] << std::endl;
std::cout << "\n~a=\n" << ~a << std::endl;
std::cout << "\na^2=\n" << (a ^ 2) << std::endl;
std::cout << "\na+b=\n" << a + b << std::endl;
std::cout << "\na+x=\n" << a + x << std::endl;
std::cout << "\na-b=\n" << a - b << std::endl;
std::cout << "\na-x=\n" << a - x << std::endl;
std::cout << "\na*b=\n" << a * b << std::endl;
std::cout << "\na*x=\n" << a * x << std::endl;
std::cout << "\na/b=\n" << a / b << std::endl;
std::cout << "\na/x=\n" << a / x << std::endl;
a += b;
std::cout << "\na+=b\n" << a << std::endl;
a += x;
std::cout << "\na+=x\n" << a << std::endl;
a -= b;
std::cout << "\na-=b\n" << a << std::endl;
a -= x;
std::cout << "\na-=x\n" << a << std::endl;
a *= b;
std::cout << "\na*=b\n" << a << std::endl;
a *= x;
std::cout << "\na*=x\n" << a << std::endl;
a /= b;
std::cout << "\na/=b\n" << a << std::endl;
a /= x;
std::cout << "\na/=x\n" << a << std::endl;
}