I am trying to find min (by row) and max (by column) element in two-dimensional (4,4) array and then store them in new array (5,5).
That is how it should look for new array (5,5):
1 2 3 4 min
5 6 7 8 min
4 4 4 5 min
3 5 5 6 min
m m m m  0
*m - max
Here it is the entire code:
#include <iostream>
using namespace std;
int main() {
    int A[4][4];/*First array*/
    int i, j;
    for (i = 0; i < 4; i++)
        for (j = 0; j < 4; j++) {
            cout << "\n A[" << i + 1 << "][" << j + 1 << "]=";
            cin >> A[i][j];
        }
    for (i = 0; i < 4; i++) {
        for (j = 0; j < 4; j++)
            cout << A[i][j] << "\t";
        cout << "\n";
    }
    {
        int min[4];/* find min on each row*/
        for (i = 0; i < 4; i++) {
            min[i] = A[0][i];
            for (j = 1; j < 4; j++) {
                if (min[i] > A[i][j])
                    min[i] = A[i][j];
            }
        }
        int newarr[5][5];/* here i create the new array 5,5)*/
        int max[5] = { 1,2,3,4,5 };
        for (i = 0; i < 4; i++) {
            for (j = 0; j < 4; j++) {
                newarr[i][j] = A[i][j];
                newarr[i][5] = max[i];
            }
        }
        for (j = 0; j < 4; j++)
            newarr[5][j] = min[j];
        cout << newarr[5][j] << "\t";
        cout << "\n";
}
}
I put random elements to max. Because so far I only test. But once I started my program it show correct only the first array. And where should be the new array it shows zero. Here it is the outcome of the debugging:
5   4   3   1   
5   6   7   9   
4   2   3   9   
4   8   4   6   
0   
How to fix it? And how to put zero in the last element (as you can see in the first table for the new array).
 
     
    