bitset<8> bp;
unsigned char up = 0;
cout << bp << endl;
cout << (unsigned)up << endl;
bp.set(3);
up = up | (1UL<<3);
cout << bp << endl;
cout << (unsigned)up << endl;
bp.reset(3);
up = up & ~(1UL<<3);
cout << bp << endl;
cout << (unsigned)up << endl;
C++ 位域操作 置0置1
最新推荐文章于 2025-07-06 16:25:12 发布