rendered paste body#include <iostream>#include <limits>using namespace std;#define SIZE 8/* Function prototypes */void bubbleSort(int array[], int size, bool ascending = true);void selectionSort(int array[], int size, bool ascending = true);int main(void) { int tarray[] = {2,1,3,1,4,6,5,10,8}; /*bubbleSort(tarray, SIZE, false);*/ selectionSort(tarray,SIZE,false); for (int i = 0; i < SIZE; i++) { cout << tarray[i] << " "; }}void bubbleSort(int array[], int size, bool ascending) { int temp = 0; for(int i=0;i<size;i++) { for(int i=0;i<(size-1);i++) { if((array[i] > array[i+1]) && ascending) { temp = array[i]; array[i] = array[i+1]; array[i+1] = temp; } else if((array[i] < array[i+1]) && !ascending) { temp = array[i]; array[i] = array[i+1]; array[i+1] = temp; } } }}void selectionSort(int array[], int size, bool ascending) { int highest = 0; int tempI; int temp = 0; int lowest = INT_MAX; for(int i=0;i<size;i++) { if(!ascending) { int highest = 0; for(int h=i;h<size;h++) { if(array[h] > highest) { highest = array[h]; tempI = h; } } temp = array[i]; array[i] = highest; array[tempI] = temp; } else { int lowest = INT_MAX; for(int j=i;j<size;j++) { if(array[j] < lowest) { lowest = array[j]; tempI = j; } } temp = array[i]; array[i] = lowest; array[tempI] = temp; } }}