title: how to read data from file line by line and storing each token in a line in vectors for further use(c++)
body: <p>I have data in the following format  (N  Snode Sterminal Dnode Dterminal):</p>
  
  <p>5 </p>
  
  <p>4</p>
  
  <p>1   2  3  4  5 </p>
  
  <p>6  7  8  9  10</p>
  
  <p>11 12 13 14 15</p>
  
  <p>...</p>
  
  <p>For the first step, I am trying to read line by line but in my output I could only output the last line but not the rest. After reading line by line, I have to store each column into vectors.</p>
  
  <p>my code:`</p>
  
  <pre><code>using namespace std;
  
  int main(){
      int cell, con, N,Snode,Sterminal,Dnode,Dterminal;
      ifstream infile;
      infile.open("file");
      infile &gt;&gt;cell;
      cout&lt;&lt;cell&lt;&lt;endl;
      infile &gt;&gt;con;
      cout&lt;&lt;con&lt;&lt;endl;
      while(infile&gt;&gt;N&gt;&gt;Snode&gt;&gt;Sterminal&gt;&gt;Dnode&gt;&gt;Dterminal);
          {
              cout&lt;&lt; N &lt;&lt;"\t"&lt;&lt; Snode&lt;&lt;"\t" &lt;&lt; Sterminal&lt;&lt;"\t" &lt;&lt; Dnode&lt;&lt; "\t" &lt;&lt; Dterminal &lt;&lt;endl;
          }
  }
  </code></pre>
  
  <p>`</p>
  
  <p>my output:</p>
  
  <p>5</p>
  
  <p>4</p>
  
  <p>3  5  6  7  8 //last line in the file</p>
  
  <p>I further want Snode, Dnode, Sterminal, Dterminal as vectors so that i can save the respective columns in it.</p>