C/C++语言:按位异或实现交换两个值 代码示例如下: #include<iostream> using namespace std; int main(){ int a,b; cin>>a>>b; a=a^b; b=b^a; a=a^b; cout<<a<<" "<<b; return 0; }