The previous exercise had a function getTestStudents() that created a few students from hard coded data. We can design a function to replace that which gets real data from the file and returns a vector with the students. It might be useful for the function to take the filename to read from as its parameter. That would make it possible to have a smaller test file that gets used by test code and a larger real file that gets used by the final program.
We already have functions that will take an entire line of text and create a Name or a Status or a vector of doubles. So all this function has to do is to use getline 3 times for each student. We will assume that we donβt know how many students there are in the file, so we will read until eof.
Construct the algorithm for getStudentData. Make sure to check for failure after trying to read in the next three lines before using them to make a student.