I'm assuming my problem was due to scope due to how I fixed it.
Since the code is long and i think it's a simple problem I'm just going to explain it.
The assignment was to make a BlackJack program. For my own enjoyment I was going to expand it to be a general card game program. So for the time being I have several global variables that I was going to assign to a parent CardGame class from wich BlackJack, Poker, etc would be derived. I say that because previously I have been told to avoid global variables.
Anyway I have a global variable "int bet" Within the BlackJack class it hits the lines
When I ran? (start debugging) the program it became an infinite loop there.Code:
cout<<"How much would you like to bet?"<<endl<<" You have $"<<money<<"."<<endl;
I should say it was an infinite loop repeating the message
"How much would you like to bet?" " You have $"<<money<<"."
However if I declare bet=0 immediately before the while statement the loop occurs as I intended it to.
I assumed that it had to do with bet not having a value before the cin line, however the global variable is set as 'int bet=0;' so I'm not sure how adding the line I did changed anything.
I know I should go through the code with the debugger a line at a time watching values,, however I am new to using it and only know how to start it from the beginning of Main() so it takes me about 30 minutes to get to the location. I guess as a second question if someone knows a source I could read about the debugger or say how to allow the program to run to a location and then let me go line by line from there. I only figured out what I know through trial and error.