题目描述
写一个函数,求两个整数之和,要求在函数体内不得使用+、-、*、/四则运算符号。
class Solution {
public:
int Add(int a, int b)
{
while (b != 0)
{
int _a = a ^ b;
unsigned int _b = ((unsigned int)(a & b) << 1);
a = _a;
b = _b;
}
return a;
}
};