Presentation is loading. Please wait.

Presentation is loading. Please wait.

P(1) = 0.166 P(2) = 0.173 P(3) = 0.167 P(4) = 0.165 P(5) = 0.166

Similar presentations


Presentation on theme: "P(1) = 0.166 P(2) = 0.173 P(3) = 0.167 P(4) = 0.165 P(5) = 0.166"— Presentation transcript:

1 P(1) = 0.166 P(2) = 0.173 P(3) = 0.167 P(4) = 0.165 P(5) = 0.166 P(6) = 0.162 textBox1 (multilines=true, scrollBars=vertical) Label1.Text="max" textBox2.Text="1000" textBox1.Text = ""; Application.Exit(); button1,2,3

2 C# 陣列 C int[] p = new int[7]; string s = ""; int p[7]; char s[50]; int max=int.Parse(textBox2.Text); for (i=1; i<7; i++) p[i]=0; ... Random r = new Random(); for (i=0; i<max; i++){ n = r.Next(1, 7); p[n]++; } n = rand()%6+1; P(1) = 0.166 P(2) = 0.173 P(3) = 0.167 P(4) = 0.165 P(5) = 0.166 P(6) = 0.162 for (i=1; i<7; i++){ x = (double) p[i] / max; s += x.ToString("0.000")+"\r\n"; } textBox1.Text = s;


Download ppt "P(1) = 0.166 P(2) = 0.173 P(3) = 0.167 P(4) = 0.165 P(5) = 0.166"

Similar presentations


Ads by Google