VERSION 5.00
Begin VB.Form frm1 
   BackColor       =   &H00004080&
   Caption         =   "Метод Монте-Карло"
   ClientHeight    =   2988
   ClientLeft      =   3984
   ClientTop       =   2988
   ClientWidth     =   4092
   LinkTopic       =   "Form1"
   ScaleHeight     =   2988
   ScaleWidth      =   4092
   Begin VB.TextBox txtS 
      Alignment       =   1  'Right Justify
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   3000
      TabIndex        =   3
      Top             =   1320
      Width           =   972
   End
   Begin VB.TextBox txtN 
      Alignment       =   1  'Right Justify
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   3000
      TabIndex        =   2
      Top             =   720
      Width           =   972
   End
   Begin VB.CommandButton cmd1 
      Caption         =   "Пуск"
      Height          =   372
      Left            =   600
      TabIndex        =   1
      Top             =   2520
      Width           =   1332
   End
   Begin VB.PictureBox pic1 
      BackColor       =   &H00FFFFFF&
      Height          =   2052
      Left            =   240
      ScaleHeight     =   2004
      ScaleWidth      =   2004
      TabIndex        =   0
      Top             =   240
      Width           =   2052
   End
   Begin VB.Label lblS 
      Alignment       =   2  'Center
      BackColor       =   &H00FFFFFF&
      Caption         =   "S"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   2520
      TabIndex        =   5
      Top             =   1320
      Width           =   372
   End
   Begin VB.Label lblN 
      Alignment       =   2  'Center
      BackColor       =   &H00FFFFFF&
      Caption         =   "N"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   204
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      Left            =   2520
      TabIndex        =   4
      Top             =   720
      Width           =   372
   End
End
Attribute VB_Name = "frm1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim dblX, dblY As Double, I, N, M, R As Long, S As Double
Private Sub cmd1_Click()
M = 0
pic1.Cls
N = Val(txtN)
pic1.Scale (-2, 2)-(2, -1)
pic1.Line (-1, 1)-(1, 0), , B
pic1.Line (-1, 0)-(0, 1)
pic1.Line (0, 1)-(1, 0)
pic1.Line (-1, 0)-(1, 0)
'Генерация точек
For I = 1 To N
dblX = 2 * Rnd - 1
dblY = Rnd
pic1.PSet (dblX, dblY)
If dblY >= 0 And Abs(dblX) + Abs(dblY) <= 1 Then M = M + 1
Next I
txtS.Text = 2 * (M / N)
'Ось X
pic1.Line (-2, 0)-(2, 0)
For I = -2 To 2
pic1.PSet (I, 0)
pic1.Print I
Next I
'Ось Y
pic1.Line (0, -1)-(0, 2)
For I = -1 To 2
pic1.PSet (0, I)
pic1.Print I
Next I
End Sub

