Can anyone help me in trying to figure out how to create and display a matrix using vectors? Totally confused on this subject.
Printable View
Can anyone help me in trying to figure out how to create and display a matrix using vectors? Totally confused on this subject.
I don't mean to mess up this thread. I'm rather new to C++. In standard C you could use a two dimentional array to represent a matrix, such as:
However the C++ vector is a container, as in:Code:char matrix[10[10];
vector<type> allocator
I can see how someone could use the string class like this:
vector<string> v_string;
Or maybe you could do something like this:
But than this would be a vector of matricies. Not quite what you want. I would like to know the answer to this question too!Code:typedef struct
{
char matrix[10][10]
}matrix_t;
vector<matrix_t> v_matrix;