int main() { int iResult=0,iNum=0; printf("输入一个整数:"); scanf("%d",&iNum); iResult=NumberOf1_Solution2(iNum); printf("结果:%d\n",iResult); return 0; }
void Test(int number, unsigned int expected) { int actual = NumberOf1_Solution1(number); if(actual == expected) printf("Solution1: Test for %p passed.\n", number); else printf("Solution1: Test for %p failed.\n", number); actual = NumberOf1_Solution2(number); if(actual == expected) printf("Solution2: Test for %p passed.\n", number); else printf("Solution2: Test for %p failed.\n", number); printf("\n"); }