Hello all, so I am writing up a few programs according to the book. However I do not entirely get what it is saying.
Student_info is a data structure.Code:istream& read(istream& read, Student_info& student){
read >> student.name >> student.midterm >> student.final;
read_hw(read, student.homework);
return read;
}
I understand that it is taking in input from the istream and then storing into the data structure. However why is it that I must return "read"? Obviously the function has a return type of istream but what does returning "read" essentially do after I store all the input? The books speaks a little about the error state. What does this mean? Can't I just turn it into a void function and have it return nothing, as long as all my data gets stored into the correct data structure?