0
How to store input values from user in a multidimensional array?
I want to store some numbers (which user will enter) in a matrix form, so how can I use 2D array for this purpose? or if there is some other method, then please post that too!
3 ответов
+ 9
cin>>n;
for (int i=0;i <n;i++)
for (int j=0;j <n;j++)
cin>>a [i][j];
For nxn matrix in array a [][]
+ 9
2 loops are used. 1st loop for the row and second loop for the column.
For a 2xw matrix of the form 00 01
10 11
the inputs are entered in the order 00 01 10 11
0
can you please elaborate it, Thanks!