# 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;
}
引用__简单的值交换
最新推荐文章于 2023-04-19 18:11:20 发布