title: C++ How can I assign an input value to a std::bitset argument?
body: <p>I want to make a simple program that will take number of bits from the input and as an output show binary numbers, written on given bits <em>(example: I type 3: it shows 000, 001, 010, 011, 100, 101, 110, 111)</em>.
  The only problem I get is in the second <em>for</em>-loop, when I try to assign variable in <em>bitset&lt;<strong>bits</strong>></em>, but it wants constant number.
  If you could help me find the solution I would be really greatful.
  Here's the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;bitset&gt;
  #include &lt;cmath&gt;
  
  using namespace std;
  
  int main() {
      int maximum_value = 0,x_temp=10;
      //cin &gt;&gt; x_temp;
      int const bits = x_temp;
  
      for (int i = 1; i &lt;= bits; i++) {
          maximum_value += pow(2, bits - i);
      }
      for (int i = maximum_value; i &gt;= 0; i--)
          cout &lt;&lt; bitset&lt;bits&gt;(maximum_value - i) &lt;&lt; endl;
      return 0;
  }
  </code></pre>