利用逆运算的swap
摘要:
#include <stdio.h>#include <iostream>using namespace std;void swap1(int &a,int &b){ a=a+b; b=a-b; a=a-b;}void swap2(int &a,int &b){ a=a^b; b=a^b; a=a^b;}int main(){ int a=10; int b=5; cout<<"before swap is a:"<<a<<" b:"<<b<&l 阅读全文
posted @ 2013-02-26 20:28 sherkey 阅读(103) 评论(0) 推荐(0)
浙公网安备 33010602011771号