Need help with Input files

I am currently stuck on a part of my HW which is a Gradebook assignment. I need to open a file and get the student ID and 9 grades, each of which are weighted differently. I am so far able to open the file and use getline to see all the information, however I am not sure how I can save each of the variables separately.

So far this is where I am currently at.

#include <iostream>
#include <fstream>

using namespace std;

int main()
string sID;
ifstream fileopen;"gradebook.txt");
while (fileopen) {
getline(fileopen, sID);

Any help or hints are really appreciated.
Create the appropriate variable type, and every time you find what you are looking for store it in one of the variables so long as you store it in the correct format
So for instance, the getline function would look something like,

getline(fileopen, sID, grade1, grade2.....,grade9);

Am I on the right path?
Somewhat, but I thought you'd only store it when you get the value you want. Not the whole thing
Well I have to calculate the overall grade, and I personally don't see a way to do it unless I store each variable separately.

Have a read of that thread and see if it contains any information that could be of you to you.
Topic archived. No new replies allowed.