I'm doing a program that has structs and here's my assignment:
For this lab, you will make an array of structures of arrays. There is a file in the dropbox of a pretend grading spreadsheet of CS 161 students. Your program should open this file and read it into the correct data structure. Since CS 161 consists of 10 assignments, 10 quizzes, 10 labs, a midterm, and a final, your data structure should look like this:
struct Student {
string name;
int asgn[10];
int quiz[10];
int lab[10];
int midterm;
int final;
};
You can assume that at this point in the quarter, there are 20 students left in the class. Thus there will be 20 entries in the file, and you will need to create an array of 20 students (called students) in main, like this:
Student students[20];
I'm working on the first part and having trouble with my code where it would have one person's name from a txt file and not the others.
bumpin' this, how's it going OP? I'm working on the same thing and it's due in a few hours. Unfortunately, I can't offer any insight just yet as I'm having trouble getting mine off the ground.
Can you post where your currently at, Revert? It would help me a bit if you didn't mind
If I understand it correctly, you have to read the data from the file inside the structure, not a string stream. Simply input the values inside the fields of your structure from the file. And depending on what separators you got in the file (either space or newline) set your getline arguments.