Reading in a file to array.. Splitting the info

Be easy one me... I am very new to C++ and having a tough time!

Here is my problem: I am attempting to read in a file that has a persons last name and 8 grades. The in file setup looks like this:

jones 77 88 77 67 88 98 44 99
clark 99 88 87 93 88 88 89 78

I am needing to have the persons last name go into a 1d array. The numbers will go into a 2d array.

here is my the piece of the code I have so far:
1
2
3
4
5
6
7
8
ifstream inFile;


    int i = 0;
    
    while (!inFile.eof()) {
        getline(inFile, names[i]);
        i++;


This reads all the data into the 1d array including the integers. I need just the names to be in the 1d array. I have played around with several different ways but no luck so far. Can anyone help?
I have been able to figure out to this point now. I am using stringstream and getline. Problem I am having now is that I am falling out of my first for loop. Any ideas why?
1
2
3
4
5
6
7
8
9
10
11
12
    string myString;
    int myInt = 0;
    
    getline(inString, myString);
    
    for (int lni = 0; inString >> myString; lni++) {
        names[lni] = myString;
        for (int gci = 0; gci < 7; gci++) {
            grades[lni][gci] = myInt;
            getline(inString, myString);
        }
    }
Topic archived. No new replies allowed.