int N = 5;
int M = 6;
int field[5][6] = {0};   

int N, M;
cin >> N >> M;
int field[N][M];   -> 표준 C++에서는 안 됨






벡터 생성자

vector<자료형> 이름(개수, 초기값);

vector<int>(M, 0)
    M = 5
[0, 0, 0, 0, 0]


위에서 만든 [0,0,0,0,0] 벡터를   N개 만들어라

vector<vector<int>> field(N, vector<int>(M, 0));


N = 3
M = 4

field =

[
  [0,0,0,0],
  [0,0,0,0],
  [0,0,0,0]
]

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: