-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
45 lines (33 loc) · 1.16 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
#include <iostream>
#include "include/CareTaker.hpp"
#include "include/Light.hpp"
int main() {
Light light(0);
Caretaker caretaker(light);
std::cout << "Initial state: " << light.getState() << std::endl;
light.setState(1);
std::cout << "State set to: " << light.getState() << std::endl;
caretaker.save();
std::cout << "State saved." << std::endl;
light.setState(2);
std::cout << "State set to: " << light.getState() << std::endl;
caretaker.save();
std::cout << "State saved." << std::endl;
light.setState(3);
std::cout << "State set to: " << light.getState() << std::endl;
caretaker.save();
std::cout << "State saved." << std::endl;
light.setState(4);
std::cout << "State set to: " << light.getState() << std::endl;
caretaker.save();
std::cout << "State saved." << std::endl;
caretaker.undo();
std::cout << "Undo performed: " << light.getState() << std::endl;
caretaker.undo();
std::cout << "Undo performed: " << light.getState() << std::endl;
caretaker.undo();
std::cout << "Undo performed: " << light.getState() << std::endl;
caretaker.undo();
std::cout << "Undo performed: " << light.getState() << std::endl;
return 0;
}