Hi. I am pretty new to C++ and have gotten pretty stuck. I have searched in some books and forum and have not been able to find a solution (which leads me to believe I'm looking for the wrong info or I have the wrong question). I appreciate your help in advance.
I have a .txt file with 20 student's first names, last names, and grades.
I am trying to place it into a struct.
I can get the .txt file to open but I am unable to get the data to be read into the struct. Is there an intermidary step I'm missing?
Here is the code snippet.
gradebook is the name of a type you created, just like int is the name of a built-in type. It looks like you want to instantiate an array of 20 gradebooks. You could do it like this:
gradebook grades[20];
and then remember you need to access grades[counter] instead of what you're using. But you really should use a std::vector. I suggest you look it up.