1 #include2 using namespace std; 3 4 #include 5 #include 6 7 int Count(u_int32_t n) 8 { 9 int count = 0; 10 while (n) { 11 ++count; 12 n = n & (n - 1); 13 } 14 return count; 15 } 16 17 int main() 18 { 19 cout << Count(128) << endl; 20 21 return 0; 22 }