rendered paste body#include <iostream> using namespace std;void fillArray(int a[], unsigned int size, int quit);int smallestInArray(const int* a, unsigned int size, int offset=0);void sortArray(int a[], unsigned int size);void swapValues(int& x, int& y);void showArray(int a[], unsigned int size, unsigned int offset=0);int main(){ int a[10]; int size = sizeof(a) / sizeof(a[0]); fillArray(a, size, -999); // Show the array, unsorted: cout << "The array, unsorted, is: " << endl; showArray(a, size); // Show the array, sorted: cout << "The array, sorted, is: " << endl; sortArray(a, size); showArray(a, size); return 0;}void fillArray(int a[], unsigned int size, int quit){ cout << "The reported size is " << size << endl; for(unsigned int x=0; a[x-1] != quit && x < size; x++){ cout << "Enter an integer, or " << quit << " to quit: "; cin >> a[x]; cout << "You said: " << a[x] << " for the " << x << "th element." << endl; }}int smallestInArray(const int a[], unsigned int size, int offset){ int indexOfSmallest = offset; for(int x=offset+1; x < size; x++){ if(a[x] < a[indexOfSmallest]){ indexOfSmallest = x; } } return indexOfSmallest;}void sortArray(int a[], unsigned int size){ int y; for(int x=0; x < size-1, x++){ y = smallestInArray(a, size, offset); swapValues(a[x], a[y]); }}void swapValues(int& x, int& y){ int tmp; tmp = x; x = y; y = tmp;}void showArray(int a[], unsigned int size, unsigned int offset){ for(unsigned int x=offset; x < size; x++){ cout << x << ": " << a[x] << endl; }}