title: How to print a grid vector in C++
body: <p>I am working on C++ printing vectors in grid.
  Here, I need to put random numbers in a vector size of 3x * 3y. And then I have to print them out with two dimensional matrix with one array. 
  I do not understand how to represent two dimensional matrix with one array. 
  In addition, I am not sure how to print out multidimensional vectors. I have to work on print_vector function which prints vectors with grid form.
  Could you please help me to improve this code below?</p>
  
  <pre><code>int main()
  {
    populate_vector();
    return 0;
  }
  
  void populate_vector()
  {
  
    int x,y;
    cout&lt;&lt;"Enter two Vectors x and y \n-&gt;";
    cin&gt;&gt; x;
    cin&gt;&gt; y;
    srand((unsigned)time(NULL));
    std::vector&lt;int&gt; xVector((3*x) * (3*y));
    for(int i = 0; (i == 3*x &amp;&amp; i == 3*y); ++i){
      xVector[i] = rand() % 255 + 1;
         if(i == 3*x){
           cout &lt;&lt; "\n";
         }
    }
    print_vector(xVector);
  }
  
  void print_vector(vector&lt;int&gt; &amp;x) {
  
  
  }
  </code></pre>