How to reset specific bit to zero in bitset with C++

1 Answer

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

using std::cout;
using std::endl;

int main()
{
	std::bitset<16> bo(std::string("0"));
	
	cout << bo << endl;

	bo[0] = 1;
	bo[3] = 1;
	bo[10] = 1;

	cout << bo << endl;

	std::cout << bo.reset(0) << endl;
	
	return 0;
}


/*
run:

0000000000000000
0000010000001001
0000010000001000

*/

 



answered Apr 18, 2018 by avibootz

Related questions

1 answer 205 views
2 answers 240 views
1 answer 216 views
1 answer 215 views
1 answer 273 views
1 answer 175 views
...