Create a void function called display with 2 parameters: the array to be displayed and size and use a dynamic array of type int and complete the main program.
CODE:
#include using namespace std;void bubleSort(int *a, int n);void display(int *a, int n);int main() { // your declarations here... cout < "enter="" number="" of="" elements="" to="" be="" sorted:=""> //accept inputs... cout < "enter="" the="" values="" ...=""> bubleSort(num, size); }void bubleSort(int *a, int n){ int last = n - 1; cout < "\nbubble="" sort..."="">< endl=""><> for (int i = 0; i < last;=""> { for (int j = last; j > i; j--) if (a[j - 1] > a[j]) swap(a[j], a[j - 1]); cout < "pass="" "="">< i="" +="" 1="">< "...."=""><> display(a, n); cout <> }}void display(int *a, int n){}
void bubleSort(int *a, int n);void display(int *a, int n);
int main() { // your declarations here... cout < "enter="" number="" of="" elements="" to="" be="" sorted:=""> //accept inputs... cout < "enter="" the="" values="" ...=""> bubleSort(num, size); }
void bubleSort(int *a, int n){ int last = n - 1; cout < "\nbubble="" sort..."="">< endl=""><> for (int i = 0; i < last;=""> { for (int j = last; j > i; j--) if (a[j - 1] > a[j]) swap(a[j], a[j - 1]); cout < "pass="" "="">< i="" +="" 1="">< "...."=""><> display(a, n); cout <> }}
void display(int *a, int n){}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here