For my class, I am working on a project to read in a text file. I need to read the ID number, Name, and a list of numbers related to each name. I am having trouble figuring out how to store these numbers so that I can keep them as a record with the structure.
Example of text file:
2546 Hill, Mary
2 3 4 5 6 7 8
5487 Lee, Jill
1 2 3 4 5 6 7
My code:
void getFileInfo(Students student_info[])
{
ifstream inFile;
I'm not sure what the problem is. You clearly already know how to read multiple fields from a line into different variables, as you're already doing that for the lines with names in.
Can you be more specific about what's confusing you?
I'm unsure of how to input the file into an int array. I used inFile to read a single integer. I used getline to read the names. I am unsure of how to read in the 7 numbers into an array from the file.