int main(){
int num=0;
int count=0;
printf("请输入:");
scanf("%d",&num);//-1
统计num的补码中有几个1
int i=0;
for(i=0;i<32;i++)
{
if(1==((num>>i) & 1))
count++;
}
printf("%d\n",count);
//num&1==1
//00000000 00000000 00000000 00000011
//00000000 00000000 00000000 00000001
//00000000 00000000 00000000 00000000
return 0;
}