c语言中异或在什么情况下可以当加法操作使用?
//在babybluein的帮助下,完成的代码#include<stdio.h>typedefunsignedintu32;u32plus(u32A,u32B){u32C...
//在babybluein的帮助下,完成的代码
#include <stdio.h>
typedef unsigned int u32;
u32 plus (u32 A, u32 B)
{
u32 C, D;
do
{
C = A^B;
D = A&B;
D = D<< 1;
A = A>>1;
B = B>>1;
} while(D != 0);
return C;
}
main()
{
printf("%d", plus(3, 40));
} 展开
#include <stdio.h>
typedef unsigned int u32;
u32 plus (u32 A, u32 B)
{
u32 C, D;
do
{
C = A^B;
D = A&B;
D = D<< 1;
A = A>>1;
B = B>>1;
} while(D != 0);
return C;
}
main()
{
printf("%d", plus(3, 40));
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询