1 #include2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 using namespace std;12 #define debug(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl13 int addusingbit(int a, int b){14 15 while (b != 0) {16 int result = a^b;17 int jinzhi = (a&b)<<1;18 a = result;19 b = jinzhi;20 }21 return a;22 }23 int main()24 {25 int a=17,b=15;26 printf("%d\n", addusingbit(a,b));27 return 0;28 }