diff options
feat(Week01): Add solutions
1 files changed, 29 insertions, 0 deletions
| -rw-r--r-- | Week01/Exercise01/main.cpp | 29 |
diff --git a/Week01/Exercise01/main.cpp b/Week01/Exercise01/main.cpp new file mode 100644 index 0000000..7958615 --- /dev/null +++ b/Week01/Exercise01/main.cpp @@ -0,0 +1,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; +} |
