#include using namespace std ; void showArray(const int array[], int size) { for (int count = 0; count < size; count++) cout << array[count] << " "; cout << endl; } void sortArray(int array[], int size) { bool swap; int temp; do { swap = false; for (int count = 0; count < (size - 1); count++) { if (array[count] > array[count + 1]) { //swap operation temp = array[count]; array[count] = array[count + 1]; array[count + 1] = temp; swap = true; } } //for } while (swap); } int main() { int arr1[] = { 5 , 4 , 3 , 2 , 1 } ; sortArray( arr1, 5 ) ; showArray( arr1 , 5 ) ; return ( 0 ) ; }