#include <iostream>
using namespace std;
void binarySort(int arr[], int size){
for(int i=0; i<size ; i++){
for(int j=0; j<size-1; j++){
if(arr[j]>arr[j+1]){
int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
cout<<"\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nElements After Sorting:
(Ascending Order)\n";
for(int i=0; i<size; i++){
cout<<"\n\tElement # "<<i+1<<" : " << arr[i];
}
cout<<endl<<endl;
}
int main()
{
int size;
cout << "Enter the size of the array: ";
cin>>size;
//size = 3;
int arr[size];
for(int i=0; i<size; i++){
cout << "Enter the Element of the array # " << i+1 <<" : ";
cin>>arr[i];
}
cout<<"\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nElements Before Sorting:\n";
for(int i=0; i<size; i++){
cout<<"\n\tElement # "<<i+1<<" : " << arr[i];
}
binarySort(arr,size);
return 0;
}