swap.cpp
// Program for Exercise 21 // (NDE, 2013-01-19) #include <iostream> using namespace std; void swap(int x, int y) { int tmp = x; x = y; y = tmp; } int main() { int first, second; cout << "Enter first integer: "; cin >> first; cout << "Enter second integer: "; cin >> second; cout << "Before swapping: " << first << " " << second << endl; swap(first, second); cout << "After swapping: " << first << " " << second << endl; return 0; }