+ 2
Can any one write a code of creating matrix using c++??
ill appriciate for that and if anyone can use short argorithms.
3 Answers
+ 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.
+ 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.
+ 1
oky thanks to you zeke williams and nuwan sameera