-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSource1.cpp
More file actions
45 lines (24 loc) · 838 Bytes
/
Copy pathSource1.cpp
File metadata and controls
45 lines (24 loc) · 838 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
#include "IHandler.h"
#include "AddHandler.h"
#include "SubHandler.h"
#include "MulHandler.h"
#include "DivHandler.h"
#include "Helpers.h"
class Helper;
int main()
{
std::vector<info> VecOfStructs;
VecOfStructs = Helper::getTasks();
/*Helper::showStruct(VecOfStructs);*/
for (auto i = 0; i < VecOfStructs.size(); i++) {
IHandler* handler = Helper::getTaskHandler(VecOfStructs[i].type);
if (handler == nullptr) {
std::cout << "Invalid task type!" << std::endl; //error handling for invalid task
return 1;
}
float result = handler->processTask(VecOfStructs[i].num1, VecOfStructs[i].num2); //using interface
std::cout << result << std::endl;
delete handler;
}
}