From 5294e73a21f3402e14fcf3379c721275e2dd19c2 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 23 Nov 2025 15:25:29 +0200 Subject: feat(Week08): Add solutions --- Week08/Exercise14.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Week08/Exercise14.cpp (limited to 'Week08/Exercise14.cpp') diff --git a/Week08/Exercise14.cpp b/Week08/Exercise14.cpp new file mode 100644 index 0000000..c224948 --- /dev/null +++ b/Week08/Exercise14.cpp @@ -0,0 +1,25 @@ +#include + +int main() { + const unsigned int ROWS = 6, COLS = 3; + + double vec[ROWS]; + for (unsigned int i = 0; i < ROWS; i++) + std::cin >> vec[i]; + + double mat[ROWS][COLS]; + for (unsigned int i = 0; i < ROWS; i++) + for (unsigned int j = 0; j < COLS; j++) + std::cin >> mat[i][j]; + + double mult[COLS] = { 0.0 }; + for (unsigned int col = 0; col < COLS; col++) + for (unsigned int row = 0; row < ROWS; row++) + mult[col] += vec[row] * mat[row][col]; + + for (unsigned int i = 0; i < COLS; i++) + std::cout << mult[i] << ' '; + std::cout << std::endl; + + return 0; +} -- cgit v1.3.1-23-gd82d