18 std::vector<Stock> & stocks,
const std::vector<Stock_event> & events,
19 bool & viewMode,
bool & advance,
bool & overlayEvent,
bool & flush,
24 std::cout <<
"Choose an option from the bar above: ";
63 std::cin.ignore(std::numeric_limits<std::streamsize>::max(),
'\n');
82 std::cin.ignore(std::numeric_limits<std::streamsize>::max(),
'\n');
91 std::vector<Stock> & stocks,
bool & flush) {
95 index =
integerInput(row, col,
"Enter the index of the stock as shown: ");
96 while (index < 1 || index >
static_cast<int>(stocks.size())) {
98 std::cout <<
"Index out of range!";
100 index =
integerInput(row, col,
"Enter the index of the stock as shown: ");
102 amount =
integerInput(row, col,
"Enter the amount to buy (0 to skip): ");
105 std::cout <<
"You cannot purchase negative amounts!";
107 index =
integerInput(row, col,
"Enter the amount to buy (0 to skip): ");
110 static_cast<int>(stocks[index - 1].num_stocks_affordable(
balance, tax))) {
112 std::cout <<
"Cannot afford!";
114 amount =
integerInput(row, col,
"Enter the amount to buy (0 to skip): ");
116 stocks[index - 1].purchase(
balance, amount, tax);
121 std::vector<Stock> & stocks,
bool & flush) {
125 index =
integerInput(row, col,
"Enter the index of the stock as shown: ");
126 while (index < 1 || index >
static_cast<int>(stocks.size())) {
128 std::cout <<
"Index out of range!";
130 index =
integerInput(row, col,
"Enter the index of the stock as shown: ");
132 amount =
integerInput(row, col,
"Enter the amount to sell (0 to skip): ");
135 std::cout <<
"You cannot sell negative amounts!";
137 index =
integerInput(row, col,
"Enter the amount to sell (0 to skip): ");
139 while (amount >
static_cast<int>(stocks[index - 1].get_quantity())) {
141 std::cout <<
"You do not have this many stocks!";
143 amount =
integerInput(row, col,
"Enter the amount to sell (0 to skip): ");
145 stocks[index - 1].sell(
balance, amount, tax);
150 viewMode = !viewMode;
158 std::cout <<
"Press [Y] to confirm: ";
160 if (input ==
'Y' || input ==
'y') {
170 std::cout <<
"Press [Y] to confirm: ";
172 if (input ==
'Y' || input ==
'y') {
static void sleep(int dur)
void buyStocks(int row, int col, float &balance, float tax, std::vector< Stock > &stocks, bool &flush)
void sellStocks(int row, int col, float &balance, float tax, std::vector< Stock > &stocks, bool &flush)
int integerInput(int row, int col, const std::string &message)
void advanceConfirmation(int row, int col, bool &advance, bool &flush)
void optionsInput(int row, int col, float &balance, float tax, std::vector< Stock > &stocks, const std::vector< Stock_event > &events, bool &viewMode, bool &advance, bool &overlayEvent, bool &flush, bool &gameQuit)
void toggleView(bool &viewMode, bool &flush)
void quitConfirmation(int row, int col, bool &flush, bool &gameQuit)
(Declarations of) human-computer interactions functions.
void listEvents(int row, int col, std::vector< Stock_event > events)
float balance
Player's balance.