-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
64 lines (51 loc) · 1.84 KB
/
main.cpp
File metadata and controls
64 lines (51 loc) · 1.84 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
/*******************************************************************************
* Author : Jesus Lopez *
* Assignment : Project One *
* Date : 11/5/17 *
* Class : CSC 17-A *
******************************************************************************/
#include "ProjHead.h"
int main(int argc, char** argv) {
//Seed Random Number Generator
srand(static_cast<unsigned int>(time(0)));
//Variables
Stock *stks = nullptr; //Input - Pointer to dynamically allocated array.
Player *plyr = nullptr; //Input - Pointer to dynamic structure.
int choice; //Input - User menu choice.
char save; //Input - If user wants to save score.
//Prints Introduction
PrntIntro();
//Initializes Stocks
stks = InitStck();
//Creates Player Structure
plyr = InitPlyr();
//Begin Seven Day Loop
for(int i = 0; i < 7; i++)
{
//Displays Main Menu
choice = MainMenu(stks, plyr, i);
//Updates Stock Values After First Day
if(i > 0)
{
UpStock(stks);
}
//User Option
switch(choice)
{
case 1:
BuyStck(stks, plyr, i);
break;
case 2:
SellStck(stks, plyr, i);
break;
default:
break;
}
//Updates Player's Assets
UpPlyr(stks, plyr);
cin.ignore();
}
//Displays Final Stats
Stats(stks, plyr);
return 0;
}