quick question here. I'm wondering how to create a 2D vector from user input. For a project, I am storing my "board" as a 2D vector, and the user will enter the height and width of it, as well as perhaps the starting configuration.
If my board is stored as:
vector<vector<int> > myBoard( width, vector<int> (height) );
//Not sure how to get width and height from input...
I will need to initialize it to the given parameters and (if the user supplies the information), fill in the board with pieces. The user will input all this information on 1 line, via 1 cin. So like this...
Please type the board config: 3 3
or
Please type the board config: 3 3 . . . . . . X . O
or
Please type the board config: 3 3 ABFDFL($%$
With the last one being an example of bad input. The first example would create a 2D vector, 3 by 3. The second would create a 2D vector, 3 by 3, and fill in the board with the position given. In this case, "." is a 0, "X" is a 1, and "O" will be a -1. That's the part I'm having the most trouble with. I could store it to a string, but it seems that going through and parsing it would be a pain in the butt...