Decimal to binary conversion in C++ with bitset

In C++, the easiest way is probably to use a std::bitset as :

Example

#include <iostream>
#include <bitset>

int main()
{
	int x = 76;

	std::bitset<8> bin_x(x);
	std::cout << bin_x;

	return 0;
}

Output

01001100