U E D R , A S I H C RSS

Random Walk2/Vector로2차원동적배열만들기

DeleteMe MultidimensionalArray ?

.

STL/vector/CookBook 통합해.

..; 한테 2 ..; ㅠ.ㅠ ..--;

vector . -_- . 행 0 화하

~cpp 
#include <iostream>
#include <vector>
using namespace std;

vector< vector<int> > ar;  //   !  .

void Alloc(int nRow, int nCol);
void SetArrayAsZero(int nRow, int nCol);
void Show(int nRow, int nCol);

int main()
{
	int row, col;
	cout << "행 " ;
	cin >> row;
	cout << "\n : ";
	cin >> col;
	Alloc(row, col);
	return 0;
}

void Alloc(int nRow, int nCol)
{
	ar.resize(nRow);

	for(int i = 0 ; i < nRow ; i++)
		ar[i].resize(nCol);
}

, 1 . row*width+col .

see also:

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:27:50
Processing time 0.0111 sec