justinpuckett

Untitled

May 27th, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. #include <string>
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9.  
  10.     srand(time(0));
  11.    
  12.     string options[] = { "L", "R" };
  13.     string direction = "";
  14.     int choice[100];
  15.  
  16.     cout << "Enter the amount of balls to drop: ";
  17.     int balls;
  18.     cin >> balls;
  19.  
  20.     cout << "Enter the amount of slots in the bean machine: ";
  21.     int slots;
  22.     cin >> slots;
  23.     cout << "" << endl;
  24.    
  25.     for (int j = 0; j < balls; j++)
  26.     {
  27.         direction = "";
  28.  
  29.         for (int i = 1; i < slots; i++)
  30.         {
  31.             choice[i] = rand() % 2;
  32.             direction = direction + options[choice[i]];
  33.         }
  34.         cout << direction << endl;
  35.     }
  36.     cout << "" << endl;
  37.     return 0;
  38.    
  39. }
Advertisement
Add Comment
Please, Sign In to add comment