void FunA()
{
int x = 100;
int y = 200;
x = x+y;
y = x-y;
x = x-y;
cout<<"x="<<x<<" y="<<y<<endl;
}
void FunB()
{
int x = 100;
int y = 200;
x ^= y;
y ^= x;
x ^= y;
cout<<"x="<<x<<" y="<<y<<endl;
}
void FunC()
{
int x = 100;
int y = 200;
x=x*y;
y=x/y;
x=x/y;
cout<<"x="<<x<<" y="<<y<<endl;
}
两个变量不用中间变量交换值的方法
最新推荐文章于 2022-11-18 15:43:17 发布