0

Hi there! I need to find the mimimum element in two-dimensional(4,4) array by row and maximum element by column and store them in another array (5,5).Maybe I did not explain properly.

That's how it should look new array (5,5):

```
1 2 3 4 min
1 2 3 4 min
1 2 3 4 min
m m m m 0
```

*m - max

So this is the first array:

```
int array[4][4];
int i, j;
for(i = 0; i < 4; i++) {
for(j = 0; j < 4; j++) {
cout << "\n array[" << i + 1 << "][" << j + 1 <<"]=";
cin >> array[i][j];
}
}
```

With this I try to find the min of each row:

```
int min[4];
for (i = 0; i<4; i++) {
min[i] = array[0][i];
for (j = 1; j<4; j++) {
if (min[i]>array[i][j])/
min[i] = array[i][j];
}
}
```

But I do not know if this code is correct.

(I guess it is not.) I dont know how to extract them(minimum elements).

And with this i will try to make new array:

```
for(i = 0; i < 4; i++) {
for(j = 0; j < 4; j++) {
newarr[i][j]=array[i][j];
newarr[i][5]=max[i];
}
}
for(j = 0; j < 4; j++)
newarr[5][j]=min[j];
```

Is this okay? There is no way to check it because I just can not find the min and max.

*Edited 11 Months Ago by legio13*