# include<cstdio> # include<iostream> using namespace std; void swap( int &a,int &b ); int main(void) { int x = 8; int y = 10; cout<<"x="<<x<<" y="<<y<<endl; swap( x,y ); cout<<"x="<<x<<" y="<<y<<endl; return 0; } void swap( int &a,int &b ) {//引用的使用 int t; t = a; a = b; b = t; }