So I have a data file that looks like this
Movie1
Year Salary
Actor1, Actor2
Movie2
Year Salary
Actor3, Actor4, Actor5
... etc
The part that's throwing me off is the actors line. It can have from 1 to 5 actors on it, separated by commas. I have to store each actor as a string into an array. This is what I have so far:
void Set_Actors(ifstream &fin){
for(int i=0;i<5;i++){
getline(fin, Actors[i], ',');
fin.ignore(1,' ');
}
}
Of course that isn't working because it stores 5 strings, but that number is different depending on the data file. So what's a better way to do it?