不适用临时变量交换两个数

void change(int a,int b)
{
	cout << "a:" << a << " b:" <<b <<endl;
	a = a^b;
	b = a^b;
	a = a^b;
	cout << "after change a:" << a << " after change b:" <<b << endl; 
}

 

posted @ 2013-09-03 23:31  l851654152  阅读(115)  评论(0编辑  收藏  举报