Okay I'm doing a roulette assignment for my C++ class. Anyhow I'm in the process of building my menus. I went all out to include every possible bet type for the American roulette. I'm currently doing my Split Bet menus, there is 24 possible horizontal split bets, and 33 verticles. So the user selects 1 to 24 for the two numbers they are betting on...
Example:
1 2 3 4 5 6 7 8
|
cout << "Which horizontal bet do you want to make?" << endl;
cout << "1. ( 1 & 2)" << endl;
cout << "2. ( 2 & 3)" << endl;
cout << "3. ( 4 & 5)" << endl;
cout << "4. ( 5 & 6)" << endl;
cout << "5. ( 7 & 8)" << endl;
cout << "6. ( 8 & 9)" << endl;
cout << "7. (10 & 11)" << endl;
|
etc...
Now to solve the many betting manners I created arrays... Many, many arrays.
1 2 3 4 5 6 7 8 9 10
|
int splith1[2] ={1, 2};
int splith2[2] ={2, 3};
int splith3[2] ={4, 5};
int splith4[2] ={5, 6};
int splith5[2] ={7, 8};
int splith6[2] ={8, 9};
int splith7[2] ={10, 11};
int splith8[2] ={11, 12};
int splith9[2] ={13, 14};
int splith10[2] ={14, 15};
|
As you can see each array ends in a number.
This is my problem, I could create 24 painstaking "if" statements and then pass my variables to my roll comparison function. However I'm trying to use the input number the user uses as a 'dynamic' variable. Example below...
1 2 3 4 5 6 7 8 9
|
{
win=rollcomparision(2, roll, splith(hor));
if (win==1)
{
payout=bet*17;
cash=payout+cash;
}
else cash=cash-bet;
}
|
'hor' is my horizontal user input selection. I would like to be able to use the variable 'hor' to be the ending number to my 'splith#' arrays. So if the user selects 1, the hor=1, then win=rollcomparision(2, roll, splith1)); 1 being the 'hor' variable. Is this even possible?