The size variable is a variable. The compiler does not know what value it might hold at any given time.
Since you are using C++, you should be using a vector or deque for this instead of an array. But if you must use an array, just make one as big as the largest size you think you'll have, and make sure that it complains if size ever gets too large.
I haven't time to look very deeply at your code ATM, so if you are still having problems later I'll help then.
Reputation Points: 1140
Solved Threads: 229
Postaholic
Offline 2,039 posts
since Oct 2007