位运算问题
键值为157653(8) ,循环位移3b = a << (16 - n);
c = a >> n;
为啥b的值始终不正确,非八进制数3, 而c的值是正确的, 八进制15765
运行结果:
Plese number and cyclic shift length!
157653 3
3375260000 15765
Process returned 16 (0x10) execution time : 3.520 s
Press any key to continue.
程序代码:#include<stdio.h>
int main (int argc, char** argv)
{
int n;
unsigned a, b, c;
printf("Plese number and cyclic shift length!\n");
scanf("%o%d", &a, &n);
b = a << (16 - n);
c = a >> n;
//c = c | b;
printf("%o %o", b, c);
return 0;
}








