-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
63 lines (58 loc) · 1.29 KB
/
main.cpp
File metadata and controls
63 lines (58 loc) · 1.29 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <iostream>
using namespace std;
class array
{
int **a;
int row,col;
public:
void enter()
{
cout<<"\n enter rows";
cin>>row;
cout<<"\n enter columns";
cin>>col;
a=new int *[row];
for(int i=0;i<row;i++)
{
a[i]=new int [col];
for(int j=0;j<col;j++)
cin>>*(*(a+i)+j);
}
}
bool operator==(array a2)
{
int flag=0;
if(row==a2.row && col==a2.col)
{
for(int i=0;i<row;i++)
{
if(flag==1)
{
for(int j=0;j<col;j++)
{
if(flag==1)
{
if(a[i][j]==a2.a[i][j] )
flag =1;
else
flag=0;
}
}
}
}
}
return flag;
}
};
int main()
{
cout << "Hello world!" << endl;
array a1,a2;
a1.enter();
a2.enter();
if(a1==a2)
cout<<"\nh arrays are equal";
else
cout<<"\nh arrays are not equal";
return 0;
}