Loading text from file into struct
I was hoping someone could give me a hand or point me in the right direction
I have a text file which consists of records (comma delimited)
1)First Name
2)Last Name
3)Age
4)Children's name (if any)
example text file:
Joe, White, 32, Karen, Bill
John, Doe, 45
Bill, Jones, 29, Steve
I have no problem opening the text file and reading the data into a vector of strings.
But now I want to create a struct called person
struct person
{
string first;
string last;
int age;
vector <string> children;
};
and create a vector of structs which will be filled with the information from the file.
I was trying to use find and substring functions but with no luck. This is my first programming experience and really only have a grasp of the fundamentals (haven't implemented classes yet)
Any help would be greatly appreciated.