Hiya.
Many apologies if the question I am about to ask has already been answered. I searched the forum, and found a couple of threads that seemed to be relevant to my problem, but none seemed to describe the problem fully.
I'm fairly new to C++, having only been using it seriously as part of my studies for the past 6 months or so.
My problem is this. I have a class which must contain two arrays of integers, eg:
class myClass
{
public:
int firstArray[size];
int secondArray[size];
readValues();
};
The readValues function takes input from a text file containing a series of integers and should write it into the relevant array using ifstream. The problem is there is no way of knowing how many values will be in this text file beforehand. Having said that, the text file will not change in size during the program operation.
I'm not sure of the best way of approaching this. Is there a way of possibly defining that the array exists within the class, and define it's size later? Or can I define it later, either within the constructor or another function?
You help in solving this problem would be most appreciated.
Many thanks
Richard