要求:
输入硬币的抛掷次数回车,弹出消息框显示正面朝上(或者反面朝上)的次数以及概率;回车继续输入硬币抛掷次数......
效果:
![](https://img.haomeiwen.com/i12581673/666bc93e5ea2ef56.png)
代码
![](https://img.haomeiwen.com/i12581673/5e89291ea5eec325.png)
为了说明概率与抛掷次数的关系,这里我也作出了曲线图:
![](https://img.haomeiwen.com/i12581673/87074c654f7dd02c.png)
由曲线图可见,概率向0.5收敛!
I love three things in the world, sun, moon and you, sun for morning, moon for night, and you forever.
浮世三千,吾爱有三,日,月与卿,日为朝,月为暮,卿为朝朝暮暮。
网友评论