#include <iostream>

using namespace std;

void newarray(int *X, int n)
{
    int j = 0;
    for (int i = 0; i < n; i++)
        if (X[i] > 0) X[j++] = X[i];
    for(; j < n; X[j++] = 0);
}

int main(int argc, char * argv[])
{
    int X[10] = { 5, 2, -1, 0, -4, 8, 1, 3, -10, 0 };
    for (int i = 0; i < 10; i++)
        cout << X[i] << ' ';
    cout << endl;
    newarray(X,10);
    for (int i = 0; i < 10; i++)
        cout << X[i] << ' ';
    cout << endl;
}

