Advertisement
Kevin_Zhang

Untitled

Aug 5th, 2022
1,255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #ifndef FUNCTION08_H_
  2. #define FUNCTION08_H_
  3.  
  4. #include <stdio.h>
  5.  
  6. void mat_mul(int n, int m, int k, int mat1[][1000], int mat2[][1000], int result[][1000]);
  7.  
  8. int n, m, k;
  9. int mat1[1000][1000], mat2[1000][1000], result[1000][1000];
  10.  
  11. int main() {
  12.     cin >> n >> m >> k;
  13.     for (int i = 0; i < n; i++) {
  14.         for (int j = 0; j < m; j++) {
  15.             scanf("%d", &mat1[i][j]);
  16.         }
  17.     }
  18.     for (int i = 0; i < m; i++) {
  19.         for (int j = 0; j < k; j++) {
  20.             scanf("%d", &mat2[i][j]);
  21.         }
  22.     }
  23.     mat_mul(n, m, k, mat1, mat2, result);
  24.     for (int i = 0; i < n; i++) {
  25.         for (int j = 0; j < k; j++) {
  26.             printf("%d%c", result[i][j], " \n"[j == k-1]);
  27.         }
  28.     }
  29.     return 0;
  30. }
  31. #endif // FUNCTION08_H_
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement