I've looked through posts that are similar but struggle to find any that exactly help with my issue.
I've created a vector of a type of class with several (int) elements in it.
e.g.
class something
{
int a;
int b;
int c;
}
in main, I have:
vector<something> NewVec;
Something thing;
I believe that I've filled it up, but can't access each of the elements of each element of the vector.
I read in from a file, loaded them into an array and then placed them into:
thing.a = arrayelement[1];
thing.b = arrayelement[2];
thing.c = arrayelement[3];
Then I did a NewVec.push_back(thing);
I've put done this within a while() statement as there are a few lines of a, b & c.
Trying to print them out, though...
I've tried for_each(NewVec.begin(), NewVec.end(), ???)
In the spot of ??? I've tried running a function from the body of the program to print the out, a function from within the class and straight reference.
How should I reference each NewVec.a, NewVec.b and NewVec.c for each element of the vector?