int add(int x, int y) {
int sum = 0;
int temp = 1;
while (temp) {
sum = x ^ y;//异或,半加
temp = (x & y) << 1;//与运算后,左移一位
x = sum;
y = temp;
}
return x;
}
int main() {
int a=1, b=2;
cout<<add(a, b);
}