-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.cpp
More file actions
96 lines (79 loc) · 1.94 KB
/
task.cpp
File metadata and controls
96 lines (79 loc) · 1.94 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
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include "task.h"
Task::Task()
{
link = "";
problem_tags.clear();
difficulty = 0;
solution = "";
}
Task::Task(std::string a, std::vector<std::string> b, int c, std::string d)
{
this->link = a;
this->problem_tags = b;
this->difficulty = c;
this->solution = d;
}
void Task::set_data(std::string a, std::vector<std::string> b, int c, std::string d)
{
link = a;
problem_tags = b;
difficulty = c;
solution = d;
}
Task Task::operator=(const Task& task)
{
this->link = task.link;
this->problem_tags = task.problem_tags;
this->difficulty = task.difficulty;
this->solution = task.solution;
return *this;
}
Task::Task(const Task& task)
{
link = task.link;
problem_tags = task.problem_tags;
difficulty = task.difficulty;
solution = task.solution;
}
std::ostream& operator<<(std::ostream& output, const Task& task)
{
output << "Link task: " << task.link << '\n';
output << "Categorii: ";
std::vector<std::string> s = task.problem_tags;
for (auto tag : s)
{
output << tag << " ";
}
output << '\n';
output << "Dificultate " << task.difficulty << '\n';
output << "Link solutie " << task.solution << '\n';
return output;
}
std::string Educational_Task::get_Help()
{
return solution;
}
std::string Educational_Task::get_Hint(int nr)
{
if(nr >= problem_tags.size())
return "Nu exista atatea taguri";
return problem_tags[nr];
}
int Task::getDifficulty() const {
return difficulty;
}
void Task::setDifficulty(int difficulty) {
Task::difficulty = difficulty;
}
Task::~Task() = default;
Educational_Task::~Educational_Task() = default;
void Task::add_difficulty(int val)
{
int x = getDifficulty() + val;
setDifficulty(x);
}
void Educational_Task::add_difficulty(int val)
{
int x = getDifficulty() + val;
setDifficulty(x);
}