vector<vector< int> > matrix;

I am trying to create a vector of vectors. I am given the number of columns and rows and where some symbols should be. If there are no symbols there is a period. It looks something like this
.....
.X#.S
.....
.....
E#...
.....
X....
..X..
.....
.....
.....
.....
@....
How would I create a vector of vectors like this starting with all periods.
Thanks for any help!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// http://ideone.com/sCBcs7

#include <iostream>
#include <vector>

using v_type = std::vector<std::vector<char>>;

void display(const v_type& v)
{
    for (auto& row : v)
    {
        for (auto& cell : row)
            std::cout << cell;
        std::cout << '\n';
    }

    std::cout << '\n';
}

int main()
{
    v_type v(13, std::vector<char>(5, '.'));

    display(v);

    v[1][1] = 'X';
    v[1][2] = '#';
    v[1][4] = 'S';

    v[4][0] = 'E';
    v[4][1] = '#';

    v[6][0] = 'X';
    v[7][2] = 'X';

    v[12][0] = '@';

    display(v);
}
Topic archived. No new replies allowed.