I am designing a simple plinko game program. Basically I am stuck on exactly how to make this unfold. How to randomize the odds of where it hits(rand() % 2)???? and how to keep it going and the ending where they get cash. Here is a pic of how it works and here is my code below it so far.
Code:
#include <iostream>
using namespace 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:
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;
}