title: How to iterate through a list of numbers in c++
body: <p>How do I iterate through a list of numbers, and how many different ways are there to do it?</p>
  
  <p>What I thought would work:</p>
  
  <pre><code>#include &lt;cstdlib&gt;
  #include &lt;iostream&gt;
  #include &lt;list&gt;
  
  
  using namespace std;
  
  
  int main()
  
  {
      int numbers[] = {2, 4, 6, 8};
      int i = 0;
      for(i=0; i&lt; numbers.size();i++)
              cout &lt;&lt; "the current number is " &lt;&lt; numbers[i];
  
  
      system("pause");
  
      return 0;
  
  }
  </code></pre>
  
  <p>I get an error on the for loop line:</p>
  
  <blockquote>
    <p>request for member <code>'size'</code> in <code>'numbers'</code>, which is of non-class type <code>'int[4]'</code></p>
  </blockquote>