so, what should I do? I was thinking that I can use resize or clear or erase function. But these functions will not free the memory. Maybe I don't need to free them and just work with them, though... But anyway, when I was working with C-arrays I simply did the following which is what I would like to emule with the vector class:

double* vec;
num = 10;
for (i = 0; i < num-1; i++)
size = (i +1) * n; // where n is a random number between 1 and 10

vec = new double[size]

for (j = 0 ; j < size-1; j++)
vec[j] = (j + 1) * (i + n);

// now I do something with "vec". After this I don't need it anymore, so
// I delete it.

delete [] vec;