#include <iostream>
using namespace std;
void printArray( int **array, int count )
{
for ( int i = 0; i < count; i++ )
for (int j = 0; j < count; j++)
cout << array[ i ][j] << " ";
cout << endl;
}
int main () {
int n;
cout<<"Please enter the length of your matrix : "<<endl;
cin>>n;
int **y = new int* [n];
for (int w = 0; w <= n-1; w++ ) {
y[w] = new int [n];
cout<<"Insert the elements ";
for (int z = 0; z <= n-1; z++)
{
cin >>y [w][z];
}
}
printArray(y, n);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBwcmludEFycmF5KCBpbnQgKiphcnJheSwgaW50IGNvdW50ICkgCiAgICB7IAogICAgICAgZm9yICggaW50IGkgPSAwOyBpIDwgY291bnQ7IGkrKyApIAogICAgICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgY291bnQ7IGorKykKICAgICAgICAgICAgICBjb3V0IDw8IGFycmF5WyBpIF1bal0gPDwgIiAiOyAKICAgICAgIGNvdXQgPDwgZW5kbDsgCiAgICB9CgppbnQgbWFpbiAoKSB7CmludCBuOwpjb3V0PDwiUGxlYXNlIGVudGVyIHRoZSBsZW5ndGggb2YgeW91ciBtYXRyaXggOiAiPDxlbmRsOwpjaW4+Pm47CmludCAqKnkgPSBuZXcgaW50KiBbbl07CmZvciAoaW50IHcgPSAwOyB3IDw9IG4tMTsgdysrICkgewoKICAgIHlbd10gPSBuZXcgaW50IFtuXTsKICAgIGNvdXQ8PCJJbnNlcnQgdGhlIGVsZW1lbnRzICI7CgogICAgICAgICAgICBmb3IgKGludCB6ID0gMDsgeiA8PSBuLTE7IHorKykKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgY2luID4+eSBbd11bel07CiAgICAgICAgICAgIH0gICAKfQoKcHJpbnRBcnJheSh5LCBuKTsKCn0=