-
Notifications
You must be signed in to change notification settings - Fork 0
/
event.h
30 lines (29 loc) · 798 Bytes
/
event.h
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
#ifndef EVENT_H
#define EVENT_H
class Event {
public:
Event(double probability = 0, std::string name = "default");
void SetEventName(Event& event) {
std::string name;
std::cout << "Please enter new name: " << std::endl;
std::cin >> name;
event.eventName = name;
};
void SetEventProbability(double probability) {
try {
if (probability <= 1 && probability >= 0) {
eventProbability = probability;
} else {
throw(probability);
}
}
catch (double probability) {
std::cout << "The probability must be between 0 and 1" << std::endl;
return;
}
}
private:
double eventProbability;
std::string eventName;
};
#endif