Website Summary Files Commits Branches @commit @diff @stats
path: root / Week01 / Exercise01 / main.cpp
blob: 79586150ca20f7c03d414a57f93a936387013e40 (plain) (blame)
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
#include <iostream>
#include "matrix.h"

int main() {
	unsigned rowsA, colsA;
	std::cin >> rowsA >> colsA;

	int** matA = newMatrix(rowsA, colsA);

	for (unsigned row = 0; row < rowsA; ++row)
		for (unsigned col = 0; col < colsA; ++col)
			std::cin >> matA[row][col];

	unsigned rowsB, colsB;
	std::cin >> rowsB >> colsB;

	int** matB = newMatrix(rowsB, colsB);

	for (unsigned row = 0; row < rowsB; ++row)
		for (unsigned col = 0; col < colsB; ++col)
			std::cin >> matB[row][col];

	std::cout << (sumMatrix((const int**)matA, rowsA, colsA) - sumMatrix((const int**)matB, rowsB, colsB)) << std::endl;

	deleteMatrix(matA, rowsA);
	deleteMatrix(matB, rowsB);

	return 0;
}