Phone.writeEntry(cout) << endl;
I would like to do this same process using vectors, so I added #include <vector>, but I am unsure of how to use push_back and use a loop to get data and then a loop to show that data? How would I set up the first loop to access my phonenum.txt file?
Thanks for your help, JLBorges. With the code that you provided me, the program prints the last entry for phonenum.txt many times. It appears that it is either accessing only one entry in the vector or storing the same values into every entry of the vector. How would I go about fixing this?
Also, I noticed that you kept my PhoneEntry Phone and added a vector. Is that necessary to make the program run with its intended function, or could I just make PhoneEntry Phone a vector?
Thanks JLBorges! I actually figured that out a couple minutes after I posted the message. Under this code, I am taking data from the text file, processing it through the PhoneEntry class, and then storing it in the vector, correct? I guess I thought I could make a vector of type PhoneEntry and skip making a separate vector...is that not possible?
Right, but I also have PhoneEntry Phone declared when the program starts. Is it possible to run this program using just the vector entries without Phone also being declared? Also, for an end of file test in this case, could I just use an if (phonenum.eof()) test?