forked from sgerwk/etrace
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcrumble.cpp
82 lines (67 loc) · 1.57 KB
/
crumble.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
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
#include <unistd.h>
#include <iostream>
using std::cout;
using std::endl;
class Crumble {
public:
void buy(const char * what, int quantity, const char * unit) {
cout << "buy " << quantity << " " << unit << " of " << what << endl;
sleep(1);
}
void buy_stuff(void) {
buy("sugar", 125, "grams");
buy("butter", 125, "grams");
buy("wheat", 200, "grams");
buy("salt", 1, "pinch");
buy("apple", 5, "pieces");
sleep(1);
}
void skin_and_dice() {
cout << "skin apples and make little dices" << endl;
sleep(1);
}
int prepare_apples() {
skin_and_dice();
sleep(1);
return 1;
}
int mix(const char * a, const char * b, const char * c, const char * d) {
cout << "mix " << a << " with " << b << ", " << c << " and " << d << endl;
sleep(1);
return 1;
}
int put(char * what, char * where) {
cout << "put " << what << " " << where << endl;
sleep(1);
}
void finalize(int apples, int crumble) {
put("apples", "below");
put("crumble", "on top");
sleep(1);
}
void bake(const char * what, int temperature_deg, int time_min) {
cout << "cook " << what << " at " << temperature_deg
<< " degrees for " << time_min << " minutes" << endl;
sleep(1);
}
void cook() {
put("apple crumble", "in oven");
bake("apple crumble", 220, 45);
sleep(1);
}
void make_apple_crumble() {
int apples;
int crumble;
buy_stuff();
apples = prepare_apples();
crumble = mix("butter", "sugar", "wheat", "salt");
finalize(apples, crumble);
cook();
sleep(1);
}
};
int main(int argc, char * argv[]) {
Crumble crumble;
crumble.make_apple_crumble();
return 0;
}