title: Using ifstream to read in the data from a file and store it in the array
body: <p>I have a text file which looks like that:</p>
  
  <pre><code>Mercury     0.39    0
  Venus       0.72    0
  Earth       1.0 1
  Mars        1.52    2
  Jupiter     5.2 67
  Saturn      9.53    63
  Uranus      19.2    27
  Neptun      30.1    14
  </code></pre>
  
  <p>There is a program which reads in the data from this file so that it is stored in array and it looks like that:</p>
  
  <pre><code>/********************************************************************************
   *
   * Planets.cpp: program reads data from the file planets.dat and prints the 
   *              information. Objects of classPlanet are used to store and print
   *              the data
   *
   * Copyright (C) October 2014               Stefan Harfst (University Oldenburg)
   * This program is made freely available with the understanding that every copy
   * of this file must include this header and that it comes without any WITHOUT
   * ANY WARRANTY.
   ********************************************************************************/
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #include "classPlanet.h"
  
  using namespace std;
  
  int main() {
    Planet planets[8];
    ifstream pdata;
  
    pdata.open("planets.dat");
  
    for (int i=0; i&lt;8; ++i) {
      string name;
      double d;
      int    n;
      pdata &gt;&gt; name &gt;&gt; d &gt;&gt; n;
      planets[i] = Planet(name, d, n);
    }
  
    for (int i=0; i&lt;8; ++i) 
      planets[i].print();
  
  }
  </code></pre>
  
  <p>I would be grateful if you help me understand the line " data >> name >> d >> n; ". Why do the values of name, d and n change in each iteration? <strong>Where do we specify which line or column of the text file the program should read in?</strong> </p>