-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
27 lines (21 loc) · 794 Bytes
/
main.cpp
File metadata and controls
27 lines (21 loc) · 794 Bytes
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
#include <bits/stdc++.h>
#include "perfect_power.h"
int main(int argc, char *argv[]) {
// Verify number of arguments for program
if (argc != 4) {
cout << "Program usage: " << argv[0] << " M R inputfile | M = number of Mappers, R = number of Reducers\n";
return -1;
}
// Converting arguments to their type
int numberOfMappers = atoi(argv[1]);
int numberOfReducers = atoi(argv[2]);
if (numberOfMappers || numberOfReducers == 0) {
cout << "ERROR: Invalid arguments!\n";
}
string filename = argv[3];
// Initialization of PerfectPower program and execution of it
PerfectPower *perfectPower = new PerfectPower(numberOfMappers, numberOfReducers, filename);
perfectPower->execute();
delete perfectPower;
return 0;
}