// page191.cpp : 定义控制台应用程序的入口点。
//C++面向对象程序设计
//练习输出结果
//传引用调用和传值调用的思路这个小题就能说明白
#include "stdafx.h"
#include <iostream>
void figure_me_out(int& x , int y , int& z);
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std ;
int a , b ,c ;
a = 10 ;
b = 20 ;
c = 30 ;
figure_me_out(a , b , c );
cout << a << " " << b << " " << c ;
cin >> a ;
return 0;
}
void figure_me_out(int& x , int y , int& z)
{
using namespace std ;
cout << x << " " << y << " " << z << endl ;
x = 1;
y = 2 ;
z = 3 ;
cout << x << " " << y << " " << z << endl ;
}
答案: 10 20 30
1 2 3
1 20 3