16,548
社区成员




void swap(int &x,int &y);
int main()
{
int x=5,y=10;
cout<<"main.before swap,x:"<<x<<"y:"<<y<<endl;
swap(x,y);
cout<<"main.after swap,x:"<<x<<"y:"<<y<<endl;
return 0;
}
void swap(int &rx,int &ry)
{
cout<<"swap.before swap,rx:"<<rx<<"ry:"<<ry<<endl;
temp=rx;
rx=ry;
ry=temp;
cout<<"swap.after swap,rx:"<<rx<<"ry:"<<ry<<endl;
}