title: Read integers from text file and store them into an array
body: <p>I am pretty much new to C++ and got this assignment from school to do and now I am stuck as I can't get it to work, some help would be appreciated. Thanks in advance.</p>
  
  <p>I have a text file with integers like this:  <code>8 3 7 1 2 0</code></p>
  
  <p>I need to create program which reads those integers and stores them in an array. Program checks text file and counts how many integers are there and accordingly creates array of size that is needed then it fills that array with integers from the file. I've came up with something like this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  using namespace std;
  
  int main(){
  
      ifstream File("data.txt");
      int count;
      File &gt;&gt; count;
      int array[count];
      for(int i=0; i&lt;count; i++){
          File &gt;&gt; array[i];
      }
  
      cout&lt;&lt;"File contains: "&lt;&lt;count&lt;&lt;" integers";
      cout&lt;&lt;"Array of integers taken from the file: ";
  
      for(int i=0; i&lt;count; i++){
          cout&lt;&lt;array[i];
      }
  }
  </code></pre>
  
  <p>For some reasons my <code>count</code> integer doesn't get any value, I've checked and it's just a zero after program and thus my whole code won't work.</p>