c++异或运算

来源:互联网 发布:如何删除mac自带软件 编辑:程序博客网 时间:2024/04/29 03:50


#include<iostream>#include<stdio.h>#include<string>using namespace std;int main(){int a = 18;int b = 10;cout << "----------------------" << endl;cout << "|       转换前a=" << a << " |"<< endl;cout << "      转换前b=" << b << " | " << endl;cout << "------------------------" << endl;a = a^b;b = a^b;a = b^a;cout << "----------------------" << endl;cout << "|       转换后a=" << a << " |" << endl;cout << "      转换后b=" << b << " | " << endl;cout << "------------------------" << endl;    system("pause");return 0;}


0 0