0

Need to make a random size (x = rows, y = columns) matrix which is filled with random numbers (only 0 or 1). So, if I don't know the size of the matrix, I use dynamic array. So far I have made this far, but obviously it isn't quite correct... Now I can get only one dimension array with random natural numbers.

```
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int **A
int x, y;
x = y = (rand() % 1);
srand (time(0));
A = new int*[x];
for ( int i = 0 ; i < x ; i++ );
A = new int*[y];
for ( int j = 0 ; j < y ; j++ );
cout << **A << endl;
delete [] A;
return 0;
}
```

Is it even possible to make this matrix (random rows, random collumns, filled with random numbers)? If so, than I would appreciate any help with the code.. Or the size of the matrix must to be initiated before filling it?

P.S. First time with random number generation for me

*Edited
by soffie*: n/a