Download presentation
Presentation is loading. Please wait.
Published byAde Jayadi Modified over 5 years ago
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;
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.