How to initialize bitset with int number in C++

1 Answer

0 votes
#include <iostream>
#include <bitset> 

using std::cout;

int main()
{
	std::bitset<8> bs(39);
	
	cout << bs << '\n';

	return 0;
}


/*
run:

00100111

*/

 



answered Jul 18, 2018 by avibootz

Related questions

5 answers 626 views
626 views asked Dec 6, 2019 by avibootz
2 answers 304 views
1 answer 277 views
1 answer 327 views
1 answer 392 views
1 answer 279 views
...