So I just took out the parts of the code that were relevant below, the entire code is too long. Above the main are the functions being used.
Here is my problem: I can drop chips into slots plenty of times with correct results of where the chip is landing. But, for myWinnings, It only displays wherever the last chip was and gives me that amount of money. Basically I need to accumlate and add the sum of each drop. So if I drop a chip 50 times, I should have 50 winnings and then add them all to get the TOTAL. I just couldn't figure it out. Any tips, pointers, ideas?
You will want to declare a variable to store the total winnings in. The function myWinnings returns the winnings for a single chip, so you can add the result of that function to the total winnings for every chip.
There may be another problem too. Notice that the function mySlotSimulator is given the value of selection_two, but selection_two is not modified within mySlotSimulator. Then, myWinnings is given the value of selection_two which is the same even after the chip has dropped. You may want to return the value of selection at the end of mySlotSimulator. Then you would input the return value of mySlotSimulator into myWinnings to get the winnings for a single chip.
man I suck. I can't get myWinnings to work. I can't get around
There may be another problem too. Notice that the function mySlotSimulator is given the value of selection_two, but selection_two is not modified within mySlotSimulator. Then, myWinnings is given the value of selection_two which is the same even after the chip has dropped.
double mySlotSimulator(double selection)//this displays where the chip goes
srand(time(0)); //seed the random number
for(int i=1; i<=12; i++ ) //12 iterations
randomizer = rand() % 2;
if (randomizer == 0)
selection += ( selection == 8 ) ? -0.5 : 0.5;
selection += ( selection == 0 ) ? 0.5 : -0.5;
cout << selection << endl; //print out the 12 drops of a chip
I may be interpreting your code incorrectly, but it seems like the user should select an input for mySlotSimulator, then the result of the simulation determines their winnings. With your original code, the user's input determined the winnings. Does that make sense? Correct me if I'm wrong, it's your code >_O.