Incorporating functions into my project..?

I started my project, which is to create some casino games. I started it and the high-low and roulette games work. However, then my professor gave us the criteria, and we have to do it using functions. So now I'm completely lost as to how I would change it up with pass-by-values, pass-by-references, voids, parameters, etc.

Here's my code without functions
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//maria.boyle
#include<iostream>
#include<ctime>
#include<string>

using namespace std;

int main ()

{

	int choice;

//random
	srand((unsigned)time(0));
	int randa = 100;
	int randb = 100;
		int money = rand()%randb+randa;


//welcome
	cout<<"Welcome to the Eiselen Casino!\n\nYou have $"<<money<<" to gamble with.\n\nYou can play High-Low, Roulette, Blackjack, or Slots. You may play for how ever long you would like as long as you do not bust. \nGood luck!\n\n";

//do while

	do {

		cout<<"You currently have $"<<money<<" to gamble with.\nWhat casino game would you like to play?\n"
			<<"1) High-Low\n"
			<<"2) Roulette\n"
			<<"3) Blackjack\n"
			<<"4) Slots\n"
			<<"5) I want to leave\n";
		cin>>choice;
//highlow
		{
		if (choice == 1) {
			srand((unsigned)time(0));
			int num = rand()%10;
			int num2 = rand()%10;
			int highlowbet;
			string HLguess;
			int payoff = 1;
			cout<<"\nHIGH-LOW. The computer will generate a random number between 0 and 10. Choose whether or not the next number will be higher or lower than the first one.\n"
				<<"I would like to bet $";
			cin>>highlowbet;
	//invalid entry
				if (highlowbet < 1 || highlowbet > money){
					cout<<"You can't bet that. Try again. What is your bet? $";
						cin>>highlowbet; }

			cout<<"The first number is "<<num<<". Think the number is higher or lower than "<<num<<"? (Respond with either 'H' for higher or 'L' for lower)\n";
			cin>>HLguess;

				if (HLguess == "Higher" && num < num2){
					cout<<"You're right! It was higher.";
					cout<<"The number was "<<num2<<".\n--------------------\n\n";
					money = money + payoff*highlowbet;
				}
				else if (HLguess == "Higher" && num > num2){
					cout<<"You're wrong. It was lower.";
					cout<<"The number was "<<num2<<".\n--------------------\n\n";
					money = money - highlowbet;
				}
				else if (HLguess == "Lower" && num < num2){
					cout<<"You're wrong. It was higher.";
					cout<<"The number was "<<num2<<".\n--------------------\n\n";
					money = money - highlowbet;
				}
				else if (HLguess == "Lower" && num > num2){
					cout<<"You're right! It was lower.";
					cout<<"The number was "<<num2<<".\n--------------------\n\n";
					money = money + payoff*highlowbet;
				}
		}

//roulette
		else if (choice == 2) {
			
			int rnum = rand()%18;
			int rbet;
			int rb;
			int rguess;
			int rbrand = rand()%2;
			int payoffr = 1;
			int payoffboth = 35;
			int payoffnum = 17;


			cout<<"ROULETTE. You need to choose either black or red, along with a number between 0 and 18, including 0 and 18. If your guessed color matches the Roulette color, you win. You also win if your guessed number matches the Roulette number. You will get paid largely if both your color and number match up.\n";
			cout<<"I would like to bet $";
			cin>>rbet;
				if (rbet < 1 || rbet > money){
					cout<<"You can't bet that. Try again. What is your bet? $";
						cin>>rbet; }
			cout<<"Red or black? (respond '0' for red, or '1' for black): ";
			cin>>rb;
			cout<<"What number, 0-18, would you like to guess: ";
			cin>>rguess;
		
			if (rb == rbrand && rguess == rnum){
				cout<<"You got both correct! Congratulations!\n\n--------------------\n\n";
				money = money + payoffboth*rbet;
			}
			else if (rb == rbrand){
				cout<<"You only matched colors.\n\n--------------------\n\n";
				money = money + payoffr*rbet;
			}
			else if (rguess == rnum){
				cout<<"You got the number right.\n\n--------------------\n\n";
				money = money + payoffnum*rbet;
			}
			else
				cout<<"You lost.";
				money = money - rbet;
		}
		


			
//blackjack
		else if (choice == 3) {
			cout<<"blackjack\n";
		}

//slots
		else if (choice == 4) {
			cout<<"slots\n";
		}

//exit
		else if (choice == 5) {
			return 0;
		}

		else if (choice != 5) {
			cout<<"Invalid entry. Try again\n\n";
		}
		}
		
	
	} while (choice !=5);
	system("PAUSE");
}


________________________________
These are the summarized requirements:

The user can play any one of the games at the casino, for as long as they want and in any order that they want, provided they haven't gone bankrupt. The games at the casino are high-low, roulette, jackpot and 21. The user should be able to leave the casino (exit the program) at any time from the program's main menu.
Have the user start with a random amount of money between $100 and $200. The program should display a menu with the following options:
1) Play High-Low
2) Play Roulette
3) Play 21
4) Play the Slots
5) Leave Casino
The program should have functions to perform each of the options 1-4 in the menu. Additionally, displaying the menu should be a function that is called from main( ) and you should create a function to calculate the amount won. A good modular design will require more than just these functions.
You should display the user's current balance before each game. After that, you should ask them how much they want to bet on that round of the game. Do not allow the player to bet more than they have or less than $1! You can require that the user only bet whole dollar amounts.
Your program should perform user input validation. The user should not be allowed to enter illegal values. If an illegal value is entered, an appropriate message should be given, and the user re-prompted. Your code should be thoroughly commented, and you should follow all of the good programming practices we have discussed in class, e.g. commenting, meaningful variable names, indentation, etc. You are not allowed to use GLOBAL VARIABLES, goto statements or exit().
_______________________________________

Any guidance or a step in the right direction?
If you don't how functions work, read this first:
http://www.cplusplus.com/doc/tutorial/functions/

What he wants is for each game to be a seperate function that main() can call (with the addition of menu()) so that main simply calls the individual functions.
Topic archived. No new replies allowed.