title: Write a program that will generate 1000 random integers in the range 0-49. (C++)
body: <p>I've looked around other questions asked here but can't quite find what I need. </p>
  
  <p>I've got this question;</p>
  
  <p>Write a program that will generate 1000 random integers in the range 0-49. It should count and report how many were in the range 0-24 and how many were in the range 25-49.</p>
  
  <p>and this is what I have so far;</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;ctime&gt;   //For time()
  #include&lt;cstdlib&gt; //For rand() and srand()
  
  
  using namespace std;
  int main()
  {
      int x;
      int counter = 0;
      int y = 0;
      int z = 0;
  
      srand(time(NULL));
  
      for (counter = 0; counter &lt; 1000; counter++) {
      {
          x = rand() % 49 + 1;
          if (x &gt;= 0 &amp;&amp; x &lt;= 24)
          {
              y++;
          }
          else if (x &gt; 24 &amp;&amp; x &lt;= 49)
          {
              z++;
          }
      }
  
      cout &lt;&lt; "Number of numbers between 0-24: " &lt;&lt; y &lt;&lt; endl;
      cout &lt;&lt; "Number of numbers between 25-49: " &lt;&lt; z &lt;&lt; endl;
  
      system("pause");
      return 0;
     }
   }
  </code></pre>
  
  <p>It loops once but I can't understand how to get it to loop over and over until 1000 numbers have been generated and categorized. </p>
  
  <p>I'm pretty new to C++ so could someone explain how to get this to loop? Have I missed something super obvious?</p>