How to resets bits 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() << endl;
	
	return 0;
}


/*
run:

0000000000000000
0000010000001001
0000000000000000

*/

 



answered Apr 18, 2018 by avibootz

Related questions

1 answer 219 views
1 answer 236 views
1 answer 190 views
1 answer 174 views
1 answer 222 views
5 answers 406 views
406 views asked Dec 6, 2019 by avibootz
...