title: output a vector bool in columns?
body: <p>I am trying to find out how to output a vector (with a lot of numbers stored) in a nice table-like way in the console.</p>
  <p>What I did so far is the following:</p>
  <pre class="lang-cpp prettyprint-override"><code>void output(const vector&lt;bool&gt;&amp; numbers, int width, int columns){
      for (int i = 0; i &lt; numbers.size(); i++){
          if (numbers[i] == true){
              cout &lt;&lt; setw(width) &lt;&lt; i;
          }
      }
  }
  </code></pre>
  <p>Basically, I tried to write a function to display a certain constant range of <code>i</code> each new line. I know I can divide the size of the vector by <code>columns</code>. Example: If the vector has 100 numbers stored, and I divide it by 5 columns, then I would basically need 20 rows to realize 5 columns. That means I want the code to output only 5 numbers from vector in each line, which would result in 20 lines with 5 numbers each line (that makes 5 columns).</p>
  <p>I will be honest here, I absolutely have no clue how to do this. I tried to find tips and tricks, and I know I somehow should work with <code>/</code> or even <code>%</code>, and also maybe a nested loop, but I can't figure out how. The tips and tricks I found on the web were all about some <code>matrix[i][j]</code> thingies, which I don't understand. My vector doesn't even have <code>[i][j]</code>.</p>
  <p>Maybe it makes sense to mention, that I am only allowed to use the following libraries: <code>&lt;vector&gt;</code>, <code>&lt;iomanip&gt;</code>, <code>&lt;iostream&gt;</code>.</p>