-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
40 lines (33 loc) · 906 Bytes
/
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
#include <iostream>
#include "Gangster.h"
#include "Mafia.h"
std::ostream &operator<<(std::ostream &os, const Mafia &mafia) {
mafia.print(mafia.getBoss(), os);
}
int main() {
auto g1 = new Gangster(1, 1);
auto g2 = new Gangster(2, 2);
auto g3 = new Gangster(3, 3);
auto g4 = new Gangster(4, 6);
auto g5 = new Gangster(5, 5);
auto g6 = new Gangster(6, 5);
g1->addSubordinate(g2);
g1->addSubordinate(g3);
g3->addSubordinate(g4);
g3->addSubordinate(g5);
g3->addSubordinate(g6);
Mafia mafia;
mafia.setBoss(g1);
mafia.isBigBoss(g1);
mafia.sendToJail(5);
std::cout << mafia;
std::cout << ".------------." << std::endl;
mafia.releaseFromJail(5);
std::cout << mafia;
/*Gangster* _g = mafia.findById(mafia.getBoss(), 3);
if(_g) {
std::cout << _g->getId();
} else {
std::cout << "Not found";
}*/
}