Question: (C++) How would you input the following data from a file into a vector of structs that have a variable for first name, last name,

(C++)

How would you input the following data from a file into a vector of structs that have a variable for first name, last name, and an array of the scores. Each student should have 4 scores so the students without 4 scores in the file would have the remaining scores set to 0.

Code:

struct Grades

{

string nameFirst;

string nameLast;

int scores[4] = { 0,0,0,0 };

};

vector students(size);

Data:

Duckey Donald 85 60 99 Goof Goofy 89 60 90 99 Brave Balto 93 1 Snow Smitn 93 66 1 77 Alice Wonderful 20 100 Samina Akthar 85 69 59 88 Simba Green 95 88 0 66 Donald Egger 90 80 70 60 Brown Deer Johny Jackson 95 99 98 92 Greg Gupta 76 79 Samuel Happy 20 100 Danny Arora 80 20 88 100 Sleepy June 70 60 99 Amy Cheng 83 22 11 98 Shelly Malik 95 88 68 91 Chelsea Tomek 100 Angela Clodfelter 95 95 95 69 Allison Nields 100 100 100 Lance Norman 88 87 100

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!