subject

Using the rand () function, fill 5 arrays of integers with the same 10 random numbers. these numbers should be values between 1-100. the arrays should hold 10 integers and named; bubblearray, selectionarray, insertionarray, quickarray, and mergearray.

2. you should use the: a. bubble sort function to sort the bubblearray b. selection sort function to sort the selectionarray c. insertion sort function to sort the insertionarray d. quick sort function to sort the quickarray e. merge sort to sort the mergearray each unsorted array should be outputted to a file name assignment2results followed by the sorted version of the array and the time taken to sort the array to the same file.

using c++

how do i edit below to fit the requirements mentioned atop?

current code:

#include
#include
#include
#include

using namespace std;

int main()
{
int i, j, n=10, temp;
int bubblearray [n];
int selectionarray [n];
int insertionarray [n];
int quickarray [n];
int mergearray [n];
srand (time(null));

for (i = 0; i < 10; i++)
{
int value = rand() % 100 + 1; // random from 1 through 100
bubblearray [i] = value;
selectionarray [i] = value;
insertionarray [i] = value;
quickarray [i] = value;
mergearray [i] = value;

cout < < "this is the randomly generated list for bubblearray: ";
cout < < bubblearray[i] < < " ";

}

cout < < "\n";
cout < < "\nthis is the list after being sorted by the bubble sort method: ";

i = 0, j = 0;

system("pause");
return 0;
}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 11:00, shawn20034
This chapter lists many ways in which becoming computer literate is beneficial. think about what your life will be like once you’re started in your career. what areas of computing will be most important for you to understand? how would an understanding of computer hardware and software you in working from home, working with groups in other countries and contributing your talents.
Answers: 1
image
Computers and Technology, 23.06.2019 14:00, camiserjai1832
In which job role will you be creating e-papers, newsletters and preiodicals
Answers: 1
image
Computers and Technology, 23.06.2019 16:30, rileysndr1782
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
image
Computers and Technology, 23.06.2019 20:30, cristalcastro901
If an appliance consumes 500 w of power and is left on for 5 hours, how much energy is used over this time period? a. 2.5 kwh b. 25 kwh c. 250 kwh d. 2500 kwh
Answers: 1
You know the right answer?
Using the rand () function, fill 5 arrays of integers with the same 10 random numbers. these numbers...

Questions in other subjects:

Konu
Mathematics, 17.07.2019 21:00