I need to work with a binary number.

I tried writing:

```
const x = 00010000;
```

But it didn't work.

I know that I can use an hexadecimal number that has the same value as `00010000`

, but I want to know if there is a type in C++ for binary numbers and if there isn't, is there another solution for my problem?

You can use

while waiting for C++0x. :)`BOOST_BINARY`

`BOOST_BINARY`

arguably has an advantage over template implementation insofar as itcan be used in C programs as well(it is 100% preprocessor-driven.)To do the converse (i.e. print out a number in binary form), you can use the non-portable

`itoa`

function, or implement your own.Unfortunately you cannot do base 2 formatting with STL streams (since

`setbase`

will only honour bases 8, 10 and 16), but youcanuse either a`std::string`

version of`itoa`

, or (the more concise, yet marginally less efficient)`std::bitset`

.produces:

Also read Herb Sutter's

The String Formatters of Manor Farmfor an interesting discussion.