标签:char cal return using cout size argc pac space
#include <iostream> using namespace std; size_t calcHasOneBit(char ch) { size_t count = 0, i = 0; char val = 0; for (i = 0; i < 8; i++) { val = ch >> i; val &= 0x01; if (val) { count++; } } return count; } int main(int argc, char * argv[]) { cout << calcHasOneBit(‘a‘) << endl; return 0; }
标签:char cal return using cout size argc pac space
原文地址:http://www.cnblogs.com/lsgxeva/p/7944863.html