Advertisement
Roctik

Untitled

Jun 10th, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.12 KB | None | 0 0
  1. #include < conio.h>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.  
  9.  
  10.     int i, j, N = 3, M = 3, a[3][3], b[3][3]; int c[3][3]; // N - число столбцев. М - число рядков.
  11.     char quit;
  12.  
  13.  
  14.     do
  15.     {
  16.         cout << "\nInput matrix A \n";
  17.  
  18.         for (i = 0; i < N; i++)
  19.         {
  20.  
  21.             for (j = 0; j < M; j++)
  22.  
  23.  
  24.                 cin >> a[i][j];
  25.  
  26.         }
  27.         cout << "Input matrix B " << endl;
  28.  
  29.         for (i = 0; i < N; i++)
  30.         {
  31.  
  32.             for (j = 0; j < M; j++)
  33.  
  34.                 cin >> b[i][j];
  35.  
  36.         }
  37.         for (i = 0; i < N; i++)
  38.         {
  39.             for (j = 0; j < M; j++)
  40.  
  41.                 c[i][j] = a[i][j] + b[i][j];
  42.  
  43.         }
  44.         system("cls");
  45.         cout << " \t Summation Matrix \n";
  46.         for (i = 0; i < N; i++)
  47.         {
  48.  
  49.             for (j = 0; j < M; j++)
  50.  
  51.                 cout << "\t" << c[i][j] << "\t";
  52.             cout << endl;
  53.  
  54.         }
  55.  
  56.         cout << "\n\t To continue press y - " ;
  57.     } while (cin >> quit && quit == 'y');
  58.  
  59.  
  60.     system("pause");
  61.     return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement