Question: C++ (below is a file i alredy create to generate number) by using that create new cpp file and write a sort function that is

C++ (below is a file i alredy create to generate number)

by using that create new cpp file and write a sort function that is O(n-squared) in C++

Acept 2 comd line arguments input file and output file name.

Reads in the integers from the input file into an array.

Sorts the array using O(n-squared) sorting algorithm.

Writes the sorted array to the output file.

mycode

#include #include #include

using namespace std;

int main(int argc, char* argv[]) { if (argc != 4) { cerr << "Usage: generate COUNT MIN MAX" << endl; return 1; }

int count = atoi(argv[1]); int min = atoi(argv[2]); int max = atoi(argv[3]);

ofstream cout("numbers.dat");

for (int i = 0; i < count; i++) { int num = (rand() % (max - min + 1)) + min; cout << num << endl; }

cout.close();

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!