41: }
42:
43: void PrintVals(int x, int y)
44: {
45: cout << “x: “ << x << “ y: “ << y << endl;
46: }
47:
48: void Square (int & rX, int & rY)
49: {
50: rX *= rX;
51: rY *= rY;
52: }
53:
54: void Cube (int & rX, int & rY)
55: {
56: int tmp;
57:
58: tmp = rX;
59: rX *= rX;
60: rX = rX * tmp;
61:
62: tmp = rY;
63: rY *= rY;
64: rY = rY * tmp;
65: }
66:
67: void Swap(int & rX, int & rY)
68: {
69: int temp;
70: temp = rX;
71: rX = rY;
72: rY = temp;
73: }
74:
75: void GetVals (int & rValOne, int & rValTwo)
76: {
77: cout << “New value for ValOne: “;
78: cin >> rValOne;
79: cout << “New value for ValTwo: “;
80: cin >> rValTwo;
81: }
(1)Change Values (2)Square (3)Cube (4)Swap: 1
(1)Change Values (2)Square (3)Cube (4)Swap: 2
(1)Change Values (2)Square (3)Cube (4)Swap: 3
(1)Change Values (2)Square (3)Cube (4)Swap: 4
(1)Change Values (2)Square (3)Cube (4)Swap: 2
New Value for ValOne: 2
New Value for ValTwo: 3
OUTPUT
522 Day 15
LISTING15.7 continued