// file: selsort.cpp // this is the selection sort function // it takes an array, and a size as parameters int selSort(int ary[], int size) { int min, minIndex; void swap(int&, int&); for (int i = 0; i < size - 1; i ++) { min = ary[i]; minIndex = i; for (int j = i + 1; j < size; j ++) if (ary[j] < min) { min = ary[j]; minIndex = j; } if (minIndex != i) swap(ary[minIndex], ary[i]); } } void swap(int &i, int &j) { int temp; temp = i; i = j; j = temp; }