-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
62 lines (49 loc) · 1.3 KB
/
main.cpp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <iostream>
#include <fstream>
#include <random>
#include <pthread.h>
#include <mutex>
#include <iomanip>
#include "Bits.h"
#include "Sorting.h"
#include "helperFunctions.h"
// Namespace:
using namespace std;
int main(int argc, char **argv)
{
i_N = -1;
if(argc > 0)
{
i_N = atoi(argv[0]);
if(i_N < 1)
{
i_N = userInput(positiveMatrix, minMatrix, maxMatrix);\
}
}
else
{
i_N = userInput(positiveMatrix, minMatrix, maxMatrix);
}
srand(unsigned(time(nullptr)));
// Variables:
int i_numThreads = 0;
int i_choice = 0;
init();
i_choice = userInput(inputChoice, mChoice, mxChoice);
switch(i_choice) {
case 1 : cout << '1'; // prints "1"
i_numThreads = userInput(threads, mThreads, mxThreads);
executeP1(i_N, i_numThreads);
break; // and exits the switch
case 2 : cout << '2';
i_numThreads = userInput(threads, mThreads, mxThreads);
runProblem2(i_N, i_numThreads);
break;
case 3 :
cout << endl << "Bye." << endl;
break;
default:
printError(errorMessage, i_choice);
}
return EXIT_SUCCESS;
}