Hi,I am having an issue with updating the initialized value MoneyTotal.
The initial value of MoneyTotal is 1000, which is displayed as desired. The issue, however, is once the user inputs their char value and the amount they wish to bet, the amount that is supposed to result from this is not updated into double MoneyTotal.
Also, when I was checking to see if the EvenBet was subtracted correctly from MoneyTotal with cout << MoneyTotal << endl; nothing was displayed on the screen.
What may be the issue? Why is MoneyTotal not being overridden by the new value?
Have I set up the do while and case statements incorrectly?
The reason for the "mysterious" behavior is due to the fact that the if-control structure on line 58 never executes. What do you think this does : if((EvenBet % 2) == 'a' && EvenBet>0)?
I initialized MoneyTotal under type double with value 1000. double MoneyTotal = 1000;
Why is it that in other programs a variable's value can be overwritten? Forgive me if this was a foolish question, I am in the process of learning. :/
I thought not declaring MoneyTotal as a const would allow for an update at each iteration.
However, if setting MoneyTotal at the beginning really is the issue, what can i do to fix this error? I want to start at an initial value of 1000.
MoneyTotal is loop local variable. That means that at the end of each iteration in is destroyed and created again at the beginning. Simplified example: