title: reading a line in text file twice
body: <p>I have this text sample</p>
  
  <pre><code>Ahmed 10
  kmal 5
  doola 6
  </code></pre>
  
  <p>And I am using this code to read it </p>
  
  <pre><code>if (myfile.is_open())
  {
    while ( myfile.good() )
  {
  
      myfile &gt;&gt; name;
      myfile &gt;&gt; phone;
      cout &lt;&lt; name &lt;&lt;" "&lt;&lt;phone&lt;&lt;endl;
  
  }
  myfile.close();
  </code></pre>
  
  <p>}</p>
  
  <p>I get this output</p>
  
  <pre><code>Ahmed 10
  kmal 5
  doola 6
  doola 6
  </code></pre>
  
  <p>Why does this code read the last line twice ?</p>