Upon encountering a peg, a chip has a 50/50 chance of going left or right. During simulation, I need to report the location of the chip as it falls so like for the left path it would be: [3.0 3.5 3.0 2.5 3.0 2.5 2.0 2.5 3.0 3.5 4.0 3.5 4.0]
Point is that I have been messing around with loops and rand. I just can't get it to work. I have the rest of the program going flawlessly. Anyone have a model that would solve this problem?
HERE IS THE IMAGE BELOW
[IMG]
http://i171.photobucket.com/albums/u319/anchorblue804/plinko_zps0c718e27.png
[/IMG]
#include <iostream>
usingnamespace std;
int main()
{
int choice;
int selection;
double user_winnings;
bool gameOn = true;
while (gameOn != false){
cout << "***PLINKO MENU***\n";
cout << " 1 - Drop one chip into one slot.\n";
cout << " 2 - Drop multiple chips into one slot.\n";
cout << " 3 - Exit.\n";
cout << " Enter your choice and press enter: ";
cin >> choice;
switch (choice)
{
case 1:
bool tf = true; //flag, whether the first or second condition's happened
cout << "\n Which Slot would you like to Drop a chip in(Please enter a slot #0-8)?"<<"\n";
cin >> selection;
if((selection < 0) || (selection > 8))
{
break;
}
else;
//simulation description
cout<<"You've won $" << "money" << "!" << endl;
break;
break;
case 2:
cout << "\n Which Slots would you like to Drop a chip in(Please enter a slot #1-9)?"<<"\n";
// rest of code here
break;
case 3:
cout << "End of Program.\n";
gameOn = false;
break;
default:
cout << "Not a Valid Choice. \n";
cout << "Choose again.\n";
cin >> choice;
break;
}
}
return 0;
}
Sorry, but that does not look like a program that would be working flawlessly. I see no rands, loops, or program even. Looks to me like your hoping someone will do it for you. Maybe someone will. Good luck..