Selecting size of vector of vectors

Posted by xbonez on Stack Overflow See other posts from Stack Overflow or by xbonez
Published on 2010-05-09T18:22:00Z Indexed on 2010/05/09 18:28 UTC
Read the original article Hit count: 188

Filed under:

I have a class called Grid that declares a vector of vectors like this:

typedef vector<int> row;
typedef vector<row> myMatrix;

myMatrix sudoku_;

The constructor looks like this:

grid::grid() : sudoku_(9,9)
{

}

As you can see, the constructor is initializing it to be a 9x9 grid. How can I make it work so that the user is asked for a number, say n, and the grid is initialized n x n ?

© Stack Overflow or respective owner

Related posts about c++