Can you use a vector or list or some other STL container that doesn't have a fixed size?
Check out the reference section at the top left of this page to see how to use them.
Btw, when compiling under g++ use the -Wall -Wextra -pedantic options to set the warning level at it's maximum.
Also use -std=c++11 to take advantage of the C++11 standard.
And the -o option to give the executable a name.
I wonder if by using STD I may loose time efficiency.
I think you will find the STL to be very efficient - it wouldn't be there if it wasn't.
Hope all goes well.