阅读背景:

c++ 学习笔记 引用传递

来源:互联网 
#include <iostream>
void swap( int &x, int &y );
main()
{
	int x, y;
	std::cout << "请输入两个不同的值:";	
	std::cin >> x >> y;
	swap( x, y );
	std::cout << "调换后输出:" << x << ' ' << y << "\n\n"; 
}
void swap( int &x, int &y )
{
	int temp;
	temp = x;
	x = y;
	y = temp;
}#include <iostream>
void swap( int &x, int &y )



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: