Question: In C++, write a function to read the data from the generated files below and construct 10 unsorted arrays. This function does not take any
In C++, write a function to read the data from the generated files below and construct 10 unsorted arrays. This function does not take any input arguments. This function declares 10 arrays of sizes sufficient to store the content of the above-generated files and constructs these arrays by reading these files. The output of this function is just a print statement to console that unsorted array generation completed.
#include
using namespace std;
//main method int main(){ srand(time(0)); int sizes[] = {1000, 4000, 8000, 10000, 40000, 80000, 100000, 400000, 800000, 1000000}; for(int i=0;i<10;i++){ ostringstream ss; ss << i; string ch = ss.str(); string filename = "dataset"+ch+".txt"; fstream file; //opening the file file.open(filename.c_str(),ios::out); for(int j=0;j
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
