Daa 7
Daa 7
#include <thread>
#include <vector>
#define SIZE 3
Int A[SIZE][SIZE] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
Int B[SIZE][SIZE] = {{9, 8, 7}, {6, 5, 4}, {3, 2, 1}};
Int C[SIZE][SIZE] = {0};
Void multiply(int row) {
For (int col = 0; col < SIZE; col++) {
For (int k = 0; k < SIZE; k++) {
C[row][col] += A[row][k] * B[k][col]; } }}
Int main() {
Std::vector<std::thread> threads;
For (int I = 0; I < SIZE; i++) {
Threads.push_back(std::thread(multiply, i)); }
For (auto &t : threads) {
t.join(); }
Std::cout << “Resultant Matrix after multiplication:” << std::endl;
For (int I = 0; I < SIZE; i++) {
For (int j = 0; j < SIZE; j++) {
Std::cout << C[i][j] << “ “; }
Std::cout << std::endl; }
Return 0;
}