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 366 views
366 views asked Dec 6, 2019 by avibootz
2 answers 167 views
1 answer 173 views
1 answer 201 views
1 answer 273 views
1 answer 167 views
...