a与b的值交换

#include <iostream>

using namespace std;

int main()
{
        int a = 1, b = 2;
        a = b-a;
        b = b-a;
        a = b+a;
        cout << "a:" <<  a << std::endl;
        cout << "b:" <<  b << std::endl;
        return 0;
}

 

posted on 2013-02-06 16:36  小风儿_xf  阅读(193)  评论(1编辑  收藏  举报

导航