#include using namespace std; void swapval(int,int); void swapref(int &, int &); void swapptr(int *, int *); void main(){ int x = 3, y = 7; cout << " preswap x,y " << x << " " << y << endl; swapval(x,y); cout << " postswap x,y " << x << " " << y << endl; cout << " preswap x,y " << x << " " << y << endl; swapref(x,y); cout << " postswap x,y " << x << " " << y << endl; cout << " preswap x,y " << x << " " << y << endl; swapptr(&x,&y); cout << " postswap x,y " << x << " " << y << endl; } void swapval(int a, int b){ int t = a; a = b; b = t; cout << " swapval a,b " << a << " " << b << endl; } void swapref(int &a, int &b){ int t = a; a = b; b = t; cout << " swapref a,b " << a << " " << b << endl; } void swapptr(int *a, int *b){ int t = *a; *a = *b; *b = t; cout << " swapptr a,b " << *a << " " << *b << endl; }