Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need someone to help me write a code for my assignment. My problem is how to i

ID: 1856497 • Letter: I

Question

I need someone to help me write a code for my assignment. My problem is how to implement the codes because I do understand the concept. So, if someone can help me come up with the code I will really appreciate it. Thank you in advance!!! Below is the Homework problem: Initialize an array[1000] with the rand() function. Then sort the array from high to low using a bubblesort. (You will have to look up a "bubble sort" and implement the algorithm.) The bubblesort should should be implimented as a function.

Explanation / Answer

#include "stdio.h"

#include "conio.h"

int main()

{

int array[1000];

int i,j;

for(i=0;i<1000;i++)

{

array[i] =rand();

}

for ( i = 0 ; i <= 1000 ; i++ )

{

for ( j = 0 ; j <= 1000 - i ; j++ )

{

if ( arr[j] > arr[j + 1] )

{

temp = arr[j] ;

arr[j] = arr[j + 1] ;

arr[j + 1] = temp ;

}

}

}

cout<< " After sorting: "; ;

for ( i = 0 ; i <= 1000 ; i++ )

cout<<" "<< arr[i];

getch();