title: How to read a binary number as input?
body: <p>Is there a way for the user to input a binary number in C or C++?</p>
  
  <p>If we write something like</p>
  
  <pre><code>int a = 0b1010;
  std::cout &lt;&lt; a &lt;&lt; std::endl
  </code></pre>
  
  <p>Then the output comes out to be 10 (when using the appropriate compiler extensions).</p>
  
  <p>but when we try to write</p>
  
  <pre><code>int n;
  std::cin &gt;&gt; n;
  int t = 0bn;
  </code></pre>
  
  <p>It gives us an error so can anyone suggest that how can we directly read binary number as input rather than using string to store input?</p>