How to set bitset bit at specific position to false in C++

1 Answer

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

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

int main()
{
	std::bitset<4> bs(string("1011"));

	cout << bs << endl;
	bs.reset(1);
	cout << bs << endl;
	bs.reset(0);
	cout << bs << endl;

	return 0;
}


/*
run:

1011
1001
1000

*/

 



answered Jul 17, 2018 by avibootz
...