title: C++ Read .txt file columns into an array
body: <p>Hello all I am not new to C++ but my skills are not very honed. Anyways I have an assignment that I was not able to complete on time, and it is really bugging me that I could not get my code to work. Now I just want to finish it so that I may know how for a future assignment.</p>
  
  <p>The data file contains the number of players and their scores on the same line and the last column is their time.</p>
  
  <p>The question is this, there is a .txt file that I must open in my program that reads as this(without bullet points).</p>
  
  <ul>
  <li>27</li>
  <li>pop 23 45 92 34 43 125</li>
  <li>cop 4  23 56 23 75 323</li>
  <li>... and so forth.</li>
  </ul>
  
  <p>How can I store/ignore the first variable and then make arrays with the data column by column (Seperated by white space)?</p>
  
  <p>Here is what I have created. I have created the arrays that I need to store the respective data into.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  #include &lt;ctime&gt;
  #include &lt;iomanip&gt;
  #include &lt;vector&gt;
  #include &lt;string&gt;
  #include &lt;sstream&gt;
  #include &lt;fstream&gt;
  using namespace std;
  
  int main()
  {
      cout&lt;&lt;"Welcome to the Score Sorting Program! \n";
      cout&lt;&lt;"Please choose a number that corresponds with the way you would like to  sort. \n";
      cout&lt;&lt;"You may also search by player if you know their username. \n";
  
      string players[50]; //Allocated space for 50 players.
      int score1[27]; //Array for Score 1
      int score2[27]; //
      int score3[27]; //
      int score4[27]; //
      int score5[27]; //
      int time[27];   //Array for Time
      int i = 0;
      int j = 0;
  
      ifstream myfile;
      myfile.open("G2347M.txt");
      if (!myfile)
      {
           cout&lt;&lt;"Could not open file. \n";
           system ("Pause");
           return -1;
      }  
  
      while (!myfile.eof())
      {
          getline(myfile, players[i], ' ');
          if (i == 26)
          {
              i=0;
              ++j;
              getline(myfile, players[i],' ');
          }
          i++;
      }    
  
  }
  </code></pre>
  
  <p>So basically I will then align players with their scores and output to another file.
  I just want to get this first part of reading the file in and then I will move on.</p>
  
  <p>I have researched similar topics (4 hours +), trying to piece together the code to get mine to work. I will continue to research and update with anything I can.</p>