-
Notifications
You must be signed in to change notification settings - Fork 170
/
Copy pathEqual_matrix.cpp
48 lines (42 loc) · 914 Bytes
/
Equal_matrix.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<iostream>
using namespace std;
int main()
{
int i, j, rows, columns, isEqual;
cout << "\nPlease Enter the rows and Columns a Equal Matrix = ";
cin >> i >> j;
int a[i][j], b[i][j];
cout << "\nPlease Enter the First Matrix Items = ";
for(rows = 0; rows < i; rows++) {
for(columns = 0; columns < i; columns++) {
cin >> a[rows][columns];
}
}
cout << "\nPlease Enter the Second Matrix Items = ";
for(rows = 0; rows < i; rows++) {
for(columns = 0; columns < i; columns++) {
cin >> b[rows][columns];
}
}
isEqual = 1;
for(rows = 0; rows < i; rows++)
{
for(columns = 0; columns < j; columns++)
{
if(a[rows][columns] != b[rows][columns])
{
isEqual = 0;
break;
}
}
}
if(isEqual == 1)
{
cout << "\nMatrix a is Equal to Matrix b";
}
else
{
cout << "\nMatrix a is Not Equal to Matrix b";
}
return 0;
}