0

I need to do 2x2 array calculation.but not using global variable.

```
enterData()
calculate()
displayResult()
```

this are the three function. but i can't pass the value..

please help me..

I've done it without using function..

```
#include <iostream>
using namespace std;
calculate(int x[][],int y[][]);
enterData()
{
int x[2][2];
int y[2][2];
int t[2][2];
for(int i=0;i<2;i++)
{
for(int j=0;j<2;j++)
{
cout<<"enter array num1"<<endl;
cin>>x[i][j];
cout<<endl;
}
}
for(i=0;i<2;i++)
{
for(int j=0;j<2;j++)
{
cout<<"enter array num2"<<endl;
cin>>y[i][j];
cout<<endl;
}
}
calculate(x,y);
return 0;
}
int calculate(x[][],y[][])
{
for(int i=0;i<2;i++)
{
for(int j=0;j<2;j++)
{
t[i][j]=x[i][j]-y[i][j];
}
displayResult(t)
cout<<endl;
}
}
displayResult(int t)
{
cout<<t<<endl;
}
```

*Edited 3 Years Ago by mike_2000_17*: Fixed formatting