title: C++ read the content from two lines of document and store in two variables
body: <p>I am trying to open a ".txt" file and read the content from the first line and the content from the second line. There are some numbers separated with  a simple "space" on both lines of the ".txt" file.</p>
  
  <p>How can I read the content from the first line and save each number in x[100] and read the content from second line and save each number in y[100]?</p>
  
  <p>PS: I am a beginner.</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;fstream&gt;
  using namespace std;
  int main() {
      int x[100], y[100], i=0;
  
      ifstream myfile("something.txt");
  
      while(myfile &gt;&gt; x[i]) {
          cout &lt;&lt; x[i] &lt;&lt; "\n";
          i++;
      }
      return 0;
  }
  </code></pre>
  
  <p>Thank you so much!</p>