代码示例:
#include<iostream>
using namespace std;
int main()
{
int m, n;
cout << "输入两个加数:";
cin >> m >> n;
int res = m^n;
int res_and = m&n;
while (res_and)
{
int temp0 = res;
int temp=res_and <<1;
res = temp0^temp;
res_and = temp0&temp;
}
cout << m << "+" << n << "=" << res << endl;
}