VERSION 5.00 Begin VB.Form Form1 BackColor = &H00808000& Caption = "Число Пи" ClientHeight = 7740 ClientLeft = 60 ClientTop = 450 ClientWidth = 9225 LinkTopic = "Form1" ScaleHeight = 7740 ScaleWidth = 9225 StartUpPosition = 3 'Windows Default Begin VB.PictureBox Picture1 BackColor = &H00C0C0C0& DrawWidth = 3 Height = 5550 Left = 1560 ScaleHeight = 5490 ScaleWidth = 5490 TabIndex = 3 Top = 240 Width = 5550 End Begin VB.Timer Timer1 Enabled = 0 'False Interval = 1 Left = 7920 Top = 6960 End Begin VB.CommandButton Command2 Caption = "Стоп" Height = 495 Left = 4920 TabIndex = 1 Top = 6960 Width = 1695 End Begin VB.CommandButton Command1 Caption = "Старт" Height = 495 Left = 1800 TabIndex = 0 Top = 6960 Width = 1695 End Begin VB.Label Label1 BackColor = &H00808000& Caption = "Число ПИ = " BeginProperty Font Name = "Monotype Corsiva" Size = 36 Charset = 204 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty Height = 735 Left = 120 TabIndex = 2 Top = 6000 Width = 8895 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Dim n, m As Integer, pi As Single Private Sub Image1_Click() End Sub Private Sub Command1_Click() Timer1.Enabled = True Picture1.Line (-1, -1)-(1, 1), , B Picture1.Circle (0, 0), 1, , , , 1 End Sub Private Sub Command2_Click() Timer1.Enabled = False pi = m / n * 4 Label1.Caption = "Число Пи ~ " + Str(pi) End Sub Private Sub Form_Load() Randomize Timer Picture1.Scale (-1, -1)-(1, 1) End Sub Private Sub Timer1_Timer() n = n + 1 x = Rnd * 2 - 1 y = Rnd * 2 - 1 If (x * x + y * y) <= 1 Then m = m + 1 Picture1.PSet (x, y), QBColor(15) Else Picture1.PSet (x, y), QBColor(12) End If End Sub