#include using namespace std; // interchange the values of the two integer variables x and y void Swap(int &x, int &y) { int temp = x; // store original value of x x = y; // replace x by y y = temp; // assign y the original value of x } // sort the n element integer array a in ascending order. void ExchangeSort(int a[], int n) { int i, j; // implement n-1 passes. locate correct values in // a[0],...,a[n-2]. for (i=0; ia[j] if (a[i] > a[j]) Swap(a[i],a[j]); } // step through the list and print each value. void PrintList(int a[], int n) { for (int i=0; i