View difference between Paste ID: TkPHVPrG and GKvNBDv9
SHOW: | | - or go back to the newest paste.
1
#include <iostream>
2
#include <ctime>
3
#include <string>
4
using namespace std;
5
     
6
int getBalls();
7
int getSlots();
8
void printDirections(int, int);
9
     
10
int main()
11
{
12
        int balls = getBalls();
13
        int slots = getSlots();
14
15
        cout << endl;
16
     
17-
	cout << "" << endl;
17+
        printDirections(balls, slots);
18
}
19-
	printDirections(balls, slots);
19+
20
int getBalls()
21-
	return 0;
21+
22
	cout << "Enter the amount of balls to drop: ";
23
	int balls;
24
	cin >> balls;
25
	return balls;
26-
	srand(time(0));
26+
27
28-
	string options[] = { "L", "R" };
28+
int getSlots()
29-
	string direction = "";
29+
30-
	int choice[100];
30+
31-
	
31+
32-
	for (int j = 0; j < balls; j++)
32+
33-
	{
33+
	return slots;
34-
		direction = "";
34+
35
36-
		for (int i = 1; i < slots; i++)
36+
37-
		{
37+
38-
			choice[i] = rand() % 2;
38+
        srand(time(0));
39-
			direction = direction + options[choice[i]];
39+
     
40-
		}
40+
        string options[] = { "L", "R" };
41-
		cout << direction << endl;
41+
        string direction = "";
42-
	}
42+
        int choice[100];
43-
	cout << "" << endl;
43+
           
44
        for (int j = 0; j < balls; j++)
45
        {
46
                direction = "";
47
     
48
                for (int i = 1; i < slots; i++)
49
                {
50
                        choice[i] = rand() % 2;
51
                        direction = direction + options[choice[i]];
52
                }
53
                cout << direction << endl;
54
        }
55
        cout << "" << endl;
56
}