Hi Beebutter,

in a 'vector' you can't access elements by index with []-operator which don't already exist. I don't know of any array-implementation which does this.

I attached sample code which demonstrates how to use vector as I think you need.

Hope that helps,

ZOPPO

in a 'vector' you can't access elements by index with []-operator which don't already exist. I don't know of any array-implementation which does this.

I attached sample code which demonstrates how to use vector as I think you need.

Hope that helps,

ZOPPO

```
int n = 4;
vector < vector < int > > v;
v.resize( n ); // set row size to 'n'
for ( int i = 0; i < n; i++ )
{
v[i].resize( n ); // set col size of row 'i' to 'n'
for ( int j = 0; j < n; j++ )
{
v[i][j] = i * j; // put a value at row 'i', col 'j'
}
}
// output the matrix
cout << "Rows: " << v.size() << endl;
for ( vector < vector < int > >::iterator itRow = v.begin(); itRow != v.end(); itRow++ )
{
for ( vector < int >::iterator itCol = itRow->begin(); itCol != itRow->end(); itCol++ )
{
cout << *itCol << " ";
}
cout << endl;
}
```