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 393 views
393 views asked Dec 6, 2019 by avibootz
2 answers 178 views
1 answer 185 views
1 answer 215 views
1 answer 285 views
1 answer 184 views
...