title: Convert a 1D Array to 2D Vector c++
body: <p>Could someone help me to write a logic that converts a ID array to  a 2D vector.</p>
  
  <p>something like</p>
  
  <pre><code>int array[] = {1, 4, 5, 7, 9, 3}; // dynamic array
  vector &lt;vector int&gt; ex;
  </code></pre>
  
  <p>How can I now place the values in ex from array.. so that it forms 2 vectors each of 3 values?</p>
  
  <p>I have searched for help with no use and have tried it myself as below:</p>
  
  <pre><code>for(int i=0; i&lt;2; i++)
  {   
          rowTemp_ex.assign(array, array+3));
   ex.push_back(rowTemp_ex);
   rowTemp_ex.erase(rowTemp_ex.begin() , rowTemp_ex.end());
  }
  </code></pre>