- 论坛徽章:
- 0
|
大家还是看代码的问题吧
《C语言复习指南与题解》 清华大学出版社
求一个原码的补码,李俟杰 编著 作为考研的参考书呢。
unsigned int getbits(unsigned);
void main()
{ unsigned int a;
printf("\n Input an octal number: ");
scanf("%o",&a);
printf("result: %o\n",getbits(a));
}
unsigned int getbits(unsigned int value)
{ unsigned int z;
z=value&10000000;
if (z ==10000000)
z=~value+1;
else
z=value;
return (z);
}
C程序设计题解及上机指导 清华大学出版社 谭浩强主编
main()
{ unsigned int a;
unsigned int getbits(unsigned);
printf("\n Input an octal number:");
scanf("%o",&a);
printf("result:%o\n",getbits(a));
}
unsigned int getbits(unsigned value)
{ unsigned int z;
z=value&0100000;
if (z==0100000)
z=~value+1;
else
z=value;
return(z);
} |
|