title: How do I add the elements of this vector together?
body: <p>The purpose of my code is to add the elements of a vector together into one integer.  This is for Problem #1 on Project Euler:</p>
  
  <p><a href="https://projecteuler.net/problem=1" rel="nofollow noreferrer">https://projecteuler.net/problem=1</a></p>
  
  <p>Here is my code:</p>
  
  <pre><code>int main()
  {
    int max_count = 1000; //The upper bound
  
    //Loop for filling vector
    for (int i = 1; i &lt;= max_count; ++i){
        int counter[max_count];
  
        if (counter[i] % 3 == 0|| counter[i] % 5 == 0){
            vector &lt;int&gt; start_point = {};
            start_point.push_back (counter[i]);
              for (auto&amp; n : start_point){
                  int sum_of_elems = 0;
                  sum_of_elems += n;
                  cout &lt;&lt; sum_of_elems;
              }   
  
        }
    }
    return 0;
  }
  </code></pre>
  
  <p>Currently, my code is outputting the following and I cannot figure out why.</p>
  
  <pre>32766143547943202305202750000-4646761603276630-76434810000-76434582500-464677056327662448-4646770403276632766-46467703232766327666032766230586999-970904238-95777621723084852023084852032766-970904244-46467688032766230624075-970911300230826120-1916976912327663276623063434032766230634681-957776214230826120140084992032766-970911280327660003276603276630-4646761603276623058081332766-464676440327663276632766230831712230745153065793306031200003276623074515300-191647711200023084852023074515365793360036000002308224802307451533657937207200-46467616032766000023083171232766230595552230831712032766327660-46467619232766230577342230822480230829920000-46467616032766230822480230829960-46467264032766230540223001920409600-46467247232766327661920409600-46467220832766000000000011072962560230556921230818160-4646738403276619204096000000230510592-1572142422000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001920169263100000170147416279176918919693827240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
  </pre>