[Solved] I have created a dice betting game. I cannot get the loop to run correctly could someone help me with finding the issue?

[ad_1]

Your problem with the bank “resetting” constantly was you never actually subtracted the bet from the bank. See the following code, I hope this helps.

cout << "You have " << bank << " coins in your bank." << endl;
cout << "How many coins would you like to bet? ";
cin >> bet;


//This is the line that you forgot.
bank = bank - bet

If you then win, then you may want to later on add some money back into the bank. (But this is up to you.) I hope this helps.

EDIT:

Here is a paste-bin for the full code as requested: http://pastebin.com/HzvRxjXL

Also, if this solves your problem, I would appreciate it if you would mark it as the answer so others don’t spend time answering a problem that has been solved.

EDIT 2:

This has a (As far as I can tell) fixed and commentated version of the code. I hope this helps: http://pastebin.com/miQjy4B5

12

[ad_2]

solved I have created a dice betting game. I cannot get the loop to run correctly could someone help me with finding the issue?