#include <iostream>
#include <iomanip>

using namespace std;

void DeleteNullRow(int** a, int& rows, int cols)
{
    int newRow = 0;
    for(int j = 0; j < rows; ++j)
    {
        bool has0 = false;
        for(int i = 0; i < cols; ++i)
            if (a[j][i] == 0) { has0 = true; break; }
        if (!has0)
        {
            for(int i = 0; i < cols; ++i)
                a[newRow][i] = a[j][i];
            newRow++;
        }
    }
    for(int i = newRow; i < rows; ++i) delete[] a[i];
    rows = newRow;
}


int main(int argc, const char * argv[])
{
    int rows = 10;
    int **a = new int*[rows];
    for(int i = 0; i < rows; ++i)
    {
        a[i] = new int[20];
        for(int j = 0; j < 20; ++j) a[i][j] = rand()%20;
    }

    for(int i = 0; i < rows; ++i)
    {
        for(int j = 0; j < 20; ++j) cout << setw(2) << a[i][j] << " ";
        cout << endl;
    }
    cout << endl;
    cout << endl;

    DeleteNullRow(a, rows, 20);

    for(int i = 0; i < rows; ++i)
    {
        for(int j = 0; j < 20; ++j) cout << setw(2) << a[i][j] << " ";
        cout << endl;
    }

}
