diff --git a/bubble_sort.cpp b/bubble_sort.cpp new file mode 100644 index 0000000..61800c9 --- /dev/null +++ b/bubble_sort.cpp @@ -0,0 +1,46 @@ +#include +using namespace std; + +void b_sort(int n, int a[]); + +int main() +{ + int a[100], n; + + cout << "Enter the number of elements to be inserted: "; + cin >> n; + + cout << "Enter the elements: \n"; + for(int i=0; i> a[i]; + } + + b_sort(n, a); + + cout << "SORTED ARRAY: \n"; + for(int i=0; i a[j+1]) + { + temp = a[j]; + a[j] = a[j+1]; + a[j+1] = temp; + } + } + } +}