不适用临时变量交换两个数
void change(int a,int b) { cout << "a:" << a << " b:" <<b <<endl; a = a^b; b = a^b; a = a^b; cout << "after change a:" << a << " after change b:" <<b << endl; }
一切源于对计算机的热爱
void change(int a,int b) { cout << "a:" << a << " b:" <<b <<endl; a = a^b; b = a^b; a = a^b; cout << "after change a:" << a << " after change b:" <<b << endl; }