title: Easy Program: Store Data from a file into a Struct Array
body: <p>I am new to programming and I am having trouble reading data from a file and entering it into a struct array, while keeping track of each data being entered:</p>
  
  <p>The file would contain:</p>
  
  <p>Name, ID Number, and GPA</p>
  
  <pre><code>    Courtney Love 1234569 3.5
      Bob Joe 1234570 3.0
      Dave Henry 1234571 2.9
  
  struct Student
  {
      string name;
      int id;
      float GPA;
      void printStudent();
  };
  </code></pre>
  
  <p>Declare an array of Student type that can hold up to 5 members:</p>
  
  <pre><code>    Student a_members[5];
  </code></pre>
  
  <p>Open the file, read in each line and store the data in the array, keep track of each student read in:</p>
  
  <pre><code>    fstream file_;
      file_.open ("students.txt");
      if(file_.is_open())
      {
         while(file_.good())
          {
          }
      }
      else
      {
      cout &lt;&lt; "File is not open"&lt;&lt; endl;
      }
      return 0;
  </code></pre>
  
  <p>I am stuck on the "while" conditional statement. After that I don't know what I should do to input the data from the file line by line and place into the "struct array". As of right now, I feel like I have tried everything! I deleted everything and figured it was best to start over. It was becoming too complicated! Maybe I am just not understanding the concept. If anyone can point me in the right direction, please do so! Thank you!</p>