HI, I'm working with vectors, but I don't understand it at all its all so confusing, I simply don't know how to use it =[. So what I'm working with is a txt file and it has data, I was able to get the data into a vector.
(This is my main.cpp)
string line
ifstream file;
file.open(argv[1]);
while (file >> line) {
list.push_back(line);
}
for (int i=0; i<list.size(); ++i) {
cout << list.at(i) << " ";
}
file.close();
cout <<endl;
With the above I was able to get the data and output it in command line.
But I also want to use those vectors in other .h files for void functions.
so my question is how should I write it so that I can access these vectors?
I have been at this for a few hours now, and I'm completely stumped =[
Thank You, Athar for helping with that.
Codekiddy list is helpful but I'm still running into a lot of issues.
I have the void function within a class, the other problem that I'm running into is that I can't declare a vector within a class, when I compile it, it yields a long list of errors that i cannot understand.