+ 2

Can any one write a code of creating matrix using c++??

ill appriciate for that and if anyone can use short argorithms.

25th Jun 2017, 6:54 AM
Denis George Nyamhanga
3 Réponses
+ 4
int matrix [3][3]; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { matrix [i][j] = 0; } } This is just for a 3 by 3 matrix, setting all element values to zero.
25th Jun 2017, 8:03 AM
Zeke Williams
Zeke Williams - avatar
+ 4
use 2 dimension array. it can be use like a table or metrix. int matrix[row][col]; assign values, int matrix[2][4] = { {1, 2, 3, 'row 1 data'} {4, 5, 6, 'row 2 data'} }; we can also use loops to iteration through the array like above comment.
25th Jun 2017, 10:16 AM
NSA94
NSA94 - avatar
+ 1
oky thanks to you zeke williams and nuwan sameera
25th Jun 2017, 10:48 AM
Denis George Nyamhanga