Is your question still open?
You could:
1) semplify your code by:
a) on row 60: omitting the else, since your if finishes with a break (this could be debatable from the point of view of legibility, anyway);
b) from row 81 to 100: writing a single
cout << " " << chipLocation;
after the sequence of if-else.
2) wrap "case 1" and "case 2" into curly bracket, apart from the final break statement, to avoid compiler errors; or...
3) ...split your code into functions called from the switch cases, that would be great.
But the question is: what is your real problem, in deeper details?
This is my output, that looks pretty pseudo-random, doesn’t it? It’s not what you were aiming to?
Welcome to the Plinko simulator!
Menu: Please select one of the following options:
0 - Quit the program
1 - Drop a single chip into one slot
2 - Drop multiple chips into one slot
Enter your selection now:
*** Drop a single chip ***
Which slot do you want to drop the chip in (0-8)?
*** Dropping chip into slot 1 ***
Path: [1.0 1.5 1.0 1.5 1.0 1.5 2.0 1.5 1.0 1.5 2.0 2.5 2.0]
Winnings: $1000.00
Menu: Please select one of the following options:
0 - Quit the program
1 - Drop a single chip into one slot
2 - Drop multiple chips into one slot
Enter your selection now:
*** Drop a single chip ***
Which slot do you want to drop the chip in (0-8)?
*** Dropping chip into slot 1 ***
Path: [1.0 1.5 2.0 1.5 2.0 1.5 1.0 1.5 1.0 1.5 1.0 0.5 1.0]
Winnings: $500.00
Menu: Please select one of the following options:
0 - Quit the program
1 - Drop a single chip into one slot
2 - Drop multiple chips into one slot
Enter your selection now:
Goodbye! |
Did you presume that initializing srand() to a constant integer would have produced the same pseudo-random number sequence in following invocations?