I was trying to open a file of strings, then store them in a vector then print the vector to prove i stored them correctly using c++.
I wanted to use the push_back function of the vector class template but i keep getting an error on the line with the push_back function like i was using the function the wrong way or something. Originally i used a borland compiler
here a portion of my code. If you have a better way to store into a vector or can help me use the push back function of the vector class, i would really appreciate it.
//sample code
datafile.open(filename);
for(j=0; !datafile.eof(); j++)
{
datafile >> q;
vector_save.push_back(q);
cout << vector_save[j];
j++;
vector_save[j] = " ";
cout << vector_save[j];
}