-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmul.cpp
43 lines (30 loc) · 778 Bytes
/
mul.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
#include <iostream>
#include "Matrix.hpp"
void mul(int*** matrix, int N1, int* N2)
{
int N3 = 0;
std::cout<<"\nInput colum number = ";
std::cin>>N3;
int opt;
std::cout<<"\nInput item to your matrix yourself or random(0 ro 1) ?\n";
std::cin>>opt;
int **sumMatr = make(*N2, N3, opt);
show(sumMatr, *N2, N3);
int **newMatrix = new int *[N1];
for(int i = 0; i < N1; i++)
{
newMatrix[i] = new int [N3];
for(int j = 0 ; j < N3; j++)
{
int res = 0;
for(int k = 0; k < *N2; k++)
{
res += ((*matrix)[i][k] * sumMatr[k][j]);
}
newMatrix[i][j] = res;
}
}
delete [] (*matrix);
*matrix = newMatrix;
*N2 = N3;
}