Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This a c++ problem as a practice for my test plz help thank you #include using namespace std; // Sort arr[] of size n using
This a c++ problem as a practice for my test plz help thank you
#include
using namespace std;
// Sort arr[] of size n using Bubble Sort. void BubbleSort (int arr[], int n) { int i, j; int temp; for (i = 0; i j+1. if (arr[j] > arr[j+1]) { //WRITE CODE TO SWAP ELEMENTS
} } } }
int main() { int n = 10;
//DECLARE A STATIC ARRAY with name arr WITH SIZE n, where n = 10 //Write CODE to enter elements in static array via comand line
BubbleSort(arr, n); // CODE to Print the sorted static array
return 0; }
19.3 Static Arrays STATIC ARRAYS Create a static integer array of 10 elements. Ask the use to enter 10 integerelements one by one via command prompt. Next sort the array in ascendirg order without using any in buit ++ sort functions. I have provided below pseudo code for bubble sort You just need to pass in the array to i:and add SWAP functionality to :he bubble sort furiction // sort rrl] of zc n using Bubble sort int ii. mp // Comparing consecutive data and witching vaLues if value a: >j+1. WRITE CODE TO SHAD ELEMENTS HERE // valua t n-i-1 will b maxinn:m t all th Valu below this indaxStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started