-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
58 lines (51 loc) · 1.59 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
46
47
48
49
50
51
52
53
54
55
56
57
58
// Main Function file
// Include headers below
#include <iostream>
#include <string>
#include "distribution.h"
#include "equations.h"
#include "event.h"
#include <vector>
std::string GetUserString(const std::string& prompt);
double GetUserDouble(const std::string& prompt);
int GetUserInt(const std::string& prompt);
void DisplayOptions() {
std::cout << "1. Create event" << std::endl;
std::cout << "2. Assign probability to event" << std::endl;
}
int main() {
std::vector<Event> eventList;
std::cout << "Please choose a number option from the list below" << std::endl;
DisplayOptions();
std::string userString = GetUserString("Put option here: ");
if (userString == "1") {
std::string eventName = GetUserString("Please name the event to something identifiable: ");
double eventProbability = GetUserDouble("Please assign a probability to the event");
new Event (eventProbability, eventName);
} else if (userString == "2") {
}
return 0;
}
std::string GetUserString(const std::string& prompt) {
std::string userAnswer = "none";
std::cout << prompt;
std::getline(std::cin, userAnswer);
std::cout << std::endl;
return userAnswer;
};
double GetUserDouble(const std::string& prompt) {
double userAnswer = 0.0;
std::cout << prompt;
std::cin >> userAnswer;
std::cin.ignore();
std::cout << std::endl;
return userAnswer;
};
int GetUserInt(const std::string& prompt) {
int userAnswer = 0;
std::cout << prompt;
std::cin >> userAnswer;
std::cin.ignore();
std::cout << std::endl;
return userAnswer;
}