交换两个数的值
///////////////////////////////////////////////////////////
// Copyright (c) 2013, ShangHai XXX Inc.
//
// FileName: exchange.cpp
//
// Description:
//
// Created: Mon Sep 23 15:40:13 2013
// Revision: Revision: 1.0
// Compiler: g++
//
///////////////////////////////////////////////////////////
#include <iostream>
using namespace std;
int main()
{
int n = 1;
int m = 5;
cout<<"before exchange\t n = "<<n<<" m = "<<m<<endl;
n = n + m;
m = n - m;
n = n - m;
cout<<"after exchange\t n = "<<n<<" m = "<<m<<endl;
n = n ^ m;
m = n ^ m;
n = n ^ m;
cout<<"after exchange\t n = "<<n<<" m = "<<m<<endl;
}