-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfullProgramTest.C
More file actions
36 lines (34 loc) · 1.02 KB
/
fullProgramTest.C
File metadata and controls
36 lines (34 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <iomanip>
using namespace std;
const char* sortName = "quickSort";
const int MIN = 10;
const int MAX = 100000;
const int FILE_SIZE = 100;
const char* executionTime = "Nguyen_Hung_timeOfExecution.txt";
void generateFile(){
cout << "Randomly generating input files:" << endl;
system("./generateFile");
}
void runQuickSort(const string& inputFile, const string& outputFile){
string cmd = "./" + string(sortName) + " " + inputFile + " " + outputFile;
system(cmd.data());
}
int main(){
generateFile();
cout << "Sorting input files:" << endl;
ofstream out;
out.open(executionTime);
out << setw(10) << "Input Size " << setw(15) << "Execution Time" << endl;
out.close();
for(int i = MIN; i <= MAX; i*=10){
for(int j = 1; j<= FILE_SIZE; ++j){
string inputFile = "inputfiles/" + to_string(i) + "_" + to_string(j);
string outputFile = "outputfiles/" + to_string(i) + "_" + to_string(j);
runQuickSort(inputFile, outputFile);
}
}
cout << "All Done!" << endl;
}