-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.cpp
63 lines (52 loc) · 1.03 KB
/
example.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
#include "./lib.h"
using namespace std;
int main() {
int** matA = new int*[4];
for(int i = 0; i <4; i++)
matA[i] = new int[4];
int** matB = new int*[4];
for(int i = 0; i <4; i++)
matB[i] = new int[4];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
matA[i][j] = 10;
}
}
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
matB[i][j] = 10;
}
}
// Displaying matrix A
cout << endl
<< "Matrix A" << endl;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
cout << matA[i][j] << " ";
}
cout << endl;
}
// Displaying matrix B
cout<<endl<<"Matrix B"<<endl;
for (int i=0;i<4;i++){
for(int j=0;j<4;j++){
cout<<matB[i][j]<<" ";
}
cout << endl;
}
int** matC = multMatrix(matA, matB, 4, 4, 4, 4);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++){
cout << matC[i][j] << "\t";
}
cout << endl;
}
int** D = transpose(matA, 4, 4);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++){
cout << D[i][j] << "\t";
}
cout << endl;
}
return 0;
}