-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdriver.cpp
More file actions
112 lines (95 loc) · 3.33 KB
/
driver.cpp
File metadata and controls
112 lines (95 loc) · 3.33 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// _____ _ ____ _ _
// |__ /___| |_ __ _ | _ \| | ___ __| | __ _ ___
// / // _ \ __/ _` | | |_) | |/ _ \/ _` |/ _` |/ _ \
// / /| __/ || (_| | | __/| | __/ (_| | (_| | __/
// /____\___|\__\__,_| |_| |_|\___|\__,_|\__, |\___|
// |___/
// ____ _ _
// | _ \ _ __ ___ (_) ___ ___| |_
// | |_) | '__/ _ \| |/ _ \/ __| __|
// | __/| | | (_) | | __/ (__| |_
// |_| |_| \___// |\___|\___|\__|
// |__/
// o
// .oo.Oo.
// O.
// Ooo'
// ___O___
// \ /
// \___/
// _ _
// (_\_)
// (__<_{}
// (_/_)
// |\ |
// \\| /|
// \|//
// |/
// ,.,.,|.,.,.
// ^`^`^`^`^`^
// Includes from files of local machines
#include "plant.hpp"
#include "accessories.hpp"
#include "machine.hpp"
// Standard library includes
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
// Declared variables go here
Machine myMachine;
vector<Plant> mySaves(3);
int choice, degreetMsg;
string yesNo;
// Introducing the user
cout << BOLDGREEN << endl << endl
<< "-------------------------------------------" << endl;
cout << "WELCOME TO YOUR AUTOMATIC WATERING MACHINE!" << endl;
cout << "-------------------------------------------" << RESET << endl;
cout << BOLDMAGENTA << "Powered by Zeta Pledge Class of ΘT" << RESET
<< endl << endl << endl;
moveOn();
do {
// Viewing main menu
cout << BOLDBLUE << endl << endl
<< "-------------------------------------------" << endl;
cout << " MAIN MENU: " << endl;
cout << "-------------------------------------------" << RESET << endl << endl;
for (int i = 0 ; i < sizeof(menu)/sizeof(menu[0]); ++i) {
cout << menu[i] << endl;
}
cout << YELLOW << "[Enter a number corresponding to each choice. Then press enter]" << RESET << endl;
cin >> choice;
system("clear");
// Invalid inputs
if (choice != 1 || choice != 2 || choice != 3) {
cout << RED << "INVALID INPUT. PLEASE TRY AGAIN!" << RESET << endl;
moveOn();
}
switch (choice) {
case 1: // Picking which plant save to water
myMachine.activate(mySaves);
break;
case 2: // View all options
view(mySaves);
break;
case 3: // Ending program
powerOff();
break;
}
} while (choice != 3);
cout << BOLDRED << endl << endl
<< "-------------------------------------------" << endl;
cout << " POWERING OFF " << endl;
cout << "-------------------------------------------" << RESET << endl << endl;
// Generator to produce a randomized degreet
// message each time machine is powered off...
unsigned seed = time(0);
srand(seed);
int max = 4,
min = 0;
degreetMsg = rand() % (max - min + 1) + min;
cout << MAGENTA << "\t" << degreetMsgList[degreetMsg] << RESET << endl << endl;
return 0;
}