#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
void bubbleSort(int arr[], int n) {
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
}
void printArr(int arr[], int n) {
cout << "| ";
for (int i = 0; i < n; i++)
cout << arr[i] << " | ";
}
int main()
{
int arr[] = {15, 5, 65, 25, 95, 85};
int len = sizeof(arr) / sizeof(*arr);
cout << "-------------------------------------" << endl;
cout << " Bubble Sort " << endl;
cout << "-------------------------------------" << endl << endl;
cout << " Array Before Sorting: " << endl;
cout << "-------------------------------------" << endl;
printArr(arr, len);
bubbleSort(arr, len);
cout << "\n\n Array After Sorting: " << endl;
cout << "-------------------------------------" << endl;
printArr(arr, len);
cout << "\n" << endl;
return 0;
}