Bubble Sort and Array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Bubble Sort and Array

Can some one help me with a c++ program? I am trying to wrap my head around how to have the size of an array be defined by the user. And then they will enter the array and it will be followed up by a bubble sort. Please help, Thank you.

5th Dec 2018, 6:09 PM
Kaitlyn Sanders
Kaitlyn Sanders - avatar
2 Answers
+ 4
int size; cin >> size; int *array = new int[size]; if (array != nullptr) { for (int index = 0; index < size; index++) cin >> array[index]; bubbleSort(array); }
5th Dec 2018, 6:43 PM
John Wells
John Wells - avatar
+ 4
Here you go 😊, Just incase sir Wells code is too advanced for you https://code.sololearn.com/cTs25L9VujJi/?ref=app
5th Dec 2018, 6:52 PM
Dlite
Dlite - avatar