title: Why does the loop with C++ io streams break after first iteration?
body: <p>This is the code I have so far. I am getting my data from an input file. The file has all the data that I need for each variable that I am calling but when I run it I only get one iteration and it exits the loop after that. I need it to run till it reaches the end of the file.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  #include &lt;cmath&gt;
  using namespace std;
  
  int main ()
  {
      ifstream pTemp("PlanetCelsius.dat");
      int pNumber, pSize;
      string pName;
      double cTemp, fTemp;
  
      cout &lt;&lt; "Number\t" &lt;&lt; "Planet Name\t" &lt;&lt; "Diameter\t" &lt;&lt; "Celsius\t" &lt;&lt; "Fahrenheit" &lt;&lt; endl;
  
          while (pTemp &gt;&gt; pNumber) 
          {
              while (pTemp &gt;&gt; pName) 
              {
                  while (pTemp &gt;&gt; pSize) 
                  {
                      while (pTemp &gt;&gt; cTemp) 
                      {
                          pTemp &gt;&gt; pNumber;
                          cout &lt;&lt; pNumber &lt;&lt; " ";
                      }
                  pTemp &gt;&gt; pName;
              cout &lt;&lt; pName &lt;&lt; " ";
                  }
          pTemp &gt;&gt; pSize;
          cout &lt;&lt; pSize &lt;&lt; " ";
              }
      pTemp &gt;&gt; cTemp;
      fTemp = 9 * (cTemp) / 5 + 32;
      cout &lt;&lt; cTemp &lt;&lt; " " &lt;&lt; fTemp &lt;&lt; endl;
          }
  
      system ("PAUSE");
          return 0;
  }
  </code></pre>