CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
using namespace std;
int main()
{
/* Define two sample matrices. */
const int r1 = 2, c1 = 3;
int a[r1][c1] = {
{1, 2, 3},
{4, 5, 6}
};
const int r2 = 3, c2 = 2;
int b[r2][c2] = {
{3, 4},
{5, 6},
{7, 8}
};
if (c1 != r2)
{
cout << "Number of columns of the first matrix must be equal to the number of rows of the second matrix.";
return 0;
}
int mult[r1][c2];
for (int i = 0; i < r1; ++i) {
for (int j = 0; j < c2; ++j)
Enter to Rename, Shift+Enter to Preview
OUTPUT
Ejecutar