I'm having a problem with a roulette game I'm making for school in C++. Everything seems to be working fine except that it doesn't give you the money that you win. Here's the code.
[hr]
[code]
#include
#include

#include "stdlib.h"
#include "time.h"
using namespace std;

short roulette_choice,spinval;
double num_bets;
long cash;

int main()
{
cash = 500;
main:
short bet = 0;

while(!bet)
{

";
cout << "(1):Place a bet
";
";
";
cout << "(4):Quit roulette
";
cout << "(5):Retire
";
cin >> roulette_choice;

switch(roulette_choice)
{

case 1: cout << "

How many bets will you place?";
cin >> num_bets;
num_bets = num_bets - 1;

{
beginning:
cout << "
What number will you place a bet on(0-36)? ";

{
goto beginning;
}

cout << "How much will you bet on number " << bet_num[bets_made] << "?";

}
bet = 1;

break;

case 2: cout << "

You have \$" << cash << " at this time.";
break;

case 3: cout << "

I think you need to go cool it for a while.";
return 0;

case 4: cout << "

Returning to the main menu now.";
return 0;

case 5: return 0;

default: cout << "

Stay away from the bar for a while would ya?";
break;
}
}

spinval = rand() %37;
cout << "

The winning number is "<< spinval << "!";

int betcheck = -1;

while(betcheck < num_bets)
{
betcheck ++;
if(bet_num[betcheck] - spinval == 0)
{
cout << "

You won with the number " << bet_num[betcheck] << "!";
cash = cash + (betmoney[betcheck] * (37.00/num_bets)) ;
cout << "
You made \$" << betmoney[betcheck] * (37.00/(num_bets+1)) << " off of this game!";
goto main;
}

}
[/code]
[hr]

Thanks ahead of time for any help.

• hi, this program works in my comp. try in yurs.
-Rohit.

#include
#include
#include
#include "stdlib.h"
#include "time.h"

short int roulette_choice,spinval;
double num_bets;
long int cash;

int main()
{
cash = 500;
main:
short bet = 0;
while(!bet)
{

";
cout << "(1):Place a bet
";
";
";
cout << "(4):Quit roulette
";
cout << "(5):Retire
";
cin >> roulette_choice;
switch(roulette_choice)
{
case 1: cout << "

How many bets will you place?";
cin >> num_bets;
num_bets = num_bets - 1;
{
beginning:
cout << "
What number will you place a bet on(0-36)? ";
goto beginning;
cout << "How much will you bet on number " << bet_num[bets_made] << "?";
}
bet = 1;
break;

case 2: cout << "

You have \$" << cash << " at this time.";
break;

case 3: cout << "

I think you need to go cool it for a while.";
return 0;

case 4: cout << "

Returning to the main menu now.";
return 0;

case 5: return 0;

default: cout << "

Stay away from the bar for a while would ya?";

}
}
spinval = rand() %37;
cout << "

The winning number is "<< spinval << "!";
int betcheck = -1;
while(betcheck < num_bets)
{
betcheck ++;
if(bet_num[betcheck] - spinval == 0)
{
cout << "

You won with the number " << bet_num[betcheck] << "!";
cash = cash + (betmoney[betcheck] * (37.00/num_bets)) ;
cout << "
You made \$" << betmoney[betcheck] * (37.00/(num_bets+1)) << " off of this game!";
goto main;
}
}
getch();
}

• Thanks for the help Rohitp, but that isn't working either. If you check your cash after winning (that would be numbers 4, 4, 7, 8 in that order. I already memorized it for debugging), it always equals 0. I'm working out of Microsoft Visual C++ 6.0 if that has any impact on it. Also, this roulette game is going to be changed into a function named Roulette(), and stuck into another program. I'm not sure if any of this information will help, but I'll feel better sticking it on here.
Thanks for taking the time to help me anyways rohitp!