.
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:
- Why Arrays are Evil
- A Class Template for N-Dimensional Generic Resizable Arrays
- Bjarne Stroustrup on Multidimensional Array 1, 2
- array보다 vector를 먼 가르는 대 로 " C++" 가르다는 가를 고 는
AcceleratedCPlusPlus










