#include <iostream> int main() { unsigned int flags = 482; unsigned int masks[2]={5,6}; std::cout << flags << std::endl; std::cout << "Before:"; for (int i = 128; i > 0; i = i / 2) { if (flags&i) { std::cout << "1"; } else { std::cout << "0"; } } std::cout << std::endl; for (int i = 0; i < 2; ++i) { flags &= ~masks[i]; } std::cout << flags << std::endl; std::cout << "After:"; for (int i = 128; i > 0; i = i / 2) { if (flags&i) { std::cout << "1"; } else { std::cout << "0"; } } std::cout << std::endl; std::cin.get(); } It works somehow wrong ... 482 Before: 11100010 480 After: 11100000
flags -= 48), just "turning off 5 and 6 bits" - dreamIIx