diff --git a/cpp/bubblesort.cpp b/cpp/bubblesort.cpp new file mode 100644 index 0000000..d3b03ba --- /dev/null +++ b/cpp/bubblesort.cpp @@ -0,0 +1,36 @@ +#include +using namespace std; +void swapping(int *ptr1, int *ptr2){ + int temp=*ptr1; + *ptr1=*ptr2; + *ptr2=temp; +} +void bubble_sort(int arr[], int n){ + int i,j; + for(i=0;iarr[j+1]){ + swapping(&arr[j], &arr[j+1]); + } + } + } +} +void print_arr(int arr[], int n){ + for(int i=0;i>n; + int arr[n]; + cout<>arr[i]; + } + bubble_sort(arr, n); + cout<