please help with probability

Hi Everyone,
at the end of my code you will see it outputs 0 the hold number and the hold number plus 1 up to 6, to the right of these numbers my code states how many times that number appeared.
My problem is instead of it telling me how many times that number appeared I need it to output the probability.
I tried to multiply the times the number appeared by 1/6, but that did not really work.

any suggestions please
thank you everyone!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  #include <iostream>
#include <cstdlib>
#include <ctime>
#include <iomanip>

using std::cout;
using std::cin;
using std::endl;
using std::setw;
using std::setprecision;

int dieRoll();
int humanTurn(int);
int hold, roll, dice, num, num0, num1, num2, num3, num4, num5, num6;
double total;
int main()

{
	srand(time(0));
	
	
	cout<<"Enter the amount to hold"<<endl;
	cin>>hold;
	cout<<""<<endl;
	cout<<"enter how many times to roll"<<endl;
	cin>>roll;
	cout<<""<<endl;
	
//	dice=(rand() % 6);
	
	cout<<"Score"<<"\t"<<"Estimated Probability"<<endl;
	
	for (total=0; total<roll; total++) // loop as many time as roll input equals
	{
		do 
		{
			num+=(rand()%6);
			
			if ((rand()%6)==1) //if the dice roll a 1 end turn start over and move to next turn
				{
					num=0;
					break;
				}
			if (num>=hold) //if the num equals or is greater than hold then start over the count move to next turn
				{
					break;
				}
		}
		
		while (num<hold); // if num is less than hold value continue loop
		
		{
			if (num==0) num0++;
			if (num==hold) num1++;
			if (num==hold+1) num2++;
			if (num==hold+2) num3++;
			if (num==hold+3) num4++;
			if (num==hold+4) num5++;
			if (num==hold+5) num6++;
		}
		
	}
	
	cout<<"0"<<"\t\t"<<num0<<endl;
	cout<<hold<<"\t\t"<<num1<<endl;
	cout<<hold+1<<"\t\t"<<num2<<endl;
	cout<<hold+2<<"\t\t"<<num3<<endl;
	cout<<hold+3<<"\t\t"<<num4<<endl;
	cout<<hold+4<<"\t\t"<<num5<<endl;
	cout<<hold+5<<"\t\t"<<num6<<endl;
	return 0;
}
Topic archived. No new replies allowed.