Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- //Function that runs the ranbom numbers
- int Stream(int x)
- {
- int p = 0;
- srand(time(0));
- x = x - 1;
- while (x > 0)
- {
- int k = rand() % 2;
- if (k == 0)
- cout << "L";
- else
- {
- cout << "R";
- p += 1;
- }
- x--;
- }
- cout << "" << endl;
- return p;
- }
- //Function that determines which array the combination falls under
- int Poles(int x)
- {
- int k = Stream(x);
- int slot[10];
- for (int i = 0; i < x; i++) //Define the arrays
- slot[i] = i;
- cout << "your ball went in slot "
- << slot[k] << endl;
- return 0;
- }
- int main()
- {
- int x, y;
- cout << "Enter the number of balls: \n";
- cin >> y;
- cout << "Enter a length \n";
- cin >> x;
- while (y > 0)
- {
- Poles(x);
- system("pause"); //Allows there to be time difference in random numbers
- y--;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement