按位异或运算,交换两个变量中的数值:
1 #include2 using namespace std; 3 4 int main() 5 { 6 int a= 0; 7 int b= 0; 8 cin>>a>>b; 9 a=a^b;10 b=a^b;11 a=a^b;12 cout< <<" "<<
input: -1 -3
output:-3 -1
本文共 282 字,大约阅读时间需要 1 分钟。
按位异或运算,交换两个变量中的数值:
1 #include2 using namespace std; 3 4 int main() 5 { 6 int a= 0; 7 int b= 0; 8 cin>>a>>b; 9 a=a^b;10 b=a^b;11 a=a^b;12 cout< <<" "<<
input: -1 -3
output:-3 -1
转载于:https://www.cnblogs.com/dejunwang/p/4755741.html