Skip to content

Instantly share code, notes, and snippets.

@isamotiuc
Created December 9, 2017 19:23
Show Gist options
  • Save isamotiuc/361da70584076adafc43f9e641986125 to your computer and use it in GitHub Desktop.
Save isamotiuc/361da70584076adafc43f9e641986125 to your computer and use it in GitHub Desktop.
#include < conio.h>
#include <iostream>
using namespace std;
int main()
{
int i, j, N = 3, M = 3, a[3][3], b[3][3]; int c[3][3]; // N - число столбцев. М - число рядков.
char quit;
do
{
cout << "\nInput matrix A \n";
for (i = 0; i < N; i++)
{
for (j = 0; j < M; j++)
cin >> a[i][j];
}
cout << "Input matrix B " << endl;
for (i = 0; i < N; i++)
{
for (j = 0; j < M; j++)
cin >> b[i][j];
}
for (i = 0; i < N; i++)
{
for (j = 0; j < M; j++)
c[i][j] = a[i][j] + b[i][j];
}
system("cls");
cout << " \t Summation Matrix \n";
for (i = 0; i < N; i++)
{
for (j = 0; j < M; j++)
cout << "\t" << c[i][j] << "\t";
cout << endl;
}
cout << "\n\t To continue press y - " ;
} while (cin >> quit && quit == 'y');
system("pause");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment