1 #include "stdafx.h"
2 #include <iostream>
3 #include <string>
4 #include <fstream>
5 #include <cmath>
6 using namespace std;
7 typedef int& ex(int &, int &);
8 int& exchange(int &, int &);
9 void acb(ex,int &,int &);
10
11 int main() {
12 int a = 123,b = 999;
13 acb(exchange, a, b);
14 cout << a << " " << b << endl;
15 system("pause");
16 }
17
18 void acb(ex e,int &a,int &b) {
19 cout << e << endl;
20 ex *exx = e;
21 exx(a, b) = 998;
22 //cout << exx(a, b) << endl;
23 }
24
25 int& exchange(int &a, int &b) {
26 int temp;
27 temp = a;
28 a = b;
29 b = temp;
30 double c = 1.3;
31 return b;
32 }