Advertisement
sazid_iiuc

Untitled

Feb 17th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.17 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. main()
  5. {
  6.  
  7.     int i, j, k, l;
  8.     cout << "First matrix size(row column):" << endl;
  9.     cin >> i >> j;
  10.     cout << "Second matrix size(row column):" << endl;
  11.     cin >> k >> l;
  12.  
  13.     int a[i][j], b[k][l], c[j][l];
  14.     if (j == k)
  15.     {
  16.         cout << "First array:" << endl;
  17.         for (int n = 0; n < i; n++)
  18.         {
  19.             for (int m = 0; m < j; m++)
  20.             {
  21.                 cin >> a[n][m];
  22.             }
  23.         }
  24.  
  25.         cout << "Second array:" << endl;
  26.  
  27.         for (int n = 0; n < k; n++)
  28.         {
  29.             for (int m = 0; m < l; m++)
  30.             {
  31.                 cin >> b[m][n];
  32.             }
  33.         }
  34.         for (int t = 0; t < j; t++)
  35.         {
  36.             for (int u = 0; u < l; u++)
  37.             {
  38.                 /* how am I supposed to multiply t=a[i]*b[l] & u=a[j]*b[k] */
  39.                 c[j][l]=c[t][u];
  40.  
  41.             }
  42.             cout << endl;
  43.         }
  44.  
  45.         for (int t = 0; t < j; t++)
  46.         {
  47.             for (int u = 0; u < l; u++)
  48.             {
  49.                 cout<<c[t][u];
  50.                
  51.             }
  52.             cout << endl;
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement