I’m currently trying to make a simple loop to show in actuality why martingale won’t work in reality, but whenever I’m starting it the “while” variable doesn’t seem to work as the loop keeps on going even when the players money are in the negative somehow??
int moneyP = 1000;
int bet = 100;
while (moneyP > 0);
{
int ball = rand()%2+1;
if (ball==1)
{
cout<<"red"<<endl;
int moneyP= moneyP+bet;
cout<<"money: "<<moneyP<<endl;
int bet = 100;
}
else
{
cout<<"black"<<endl;
int moneyP = moneyP-bet;
cout<<"money: "<<moneyP<<endl;
int bet = bet+bet;
}
}
I tried to use a do/while function instead of a simple while but I ended up in the same exact position, any ideas? Thanks in advance!
Eygon of Carim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.