VERSION 5.00
Begin VB.Form frm1 
   BackColor       =   &H00004040&
   Caption         =   "График функции"
   ClientHeight    =   4680
   ClientLeft      =   2568
   ClientTop       =   1896
   ClientWidth     =   7236
   LinkTopic       =   "Form1"
   ScaleHeight     =   4680
   ScaleWidth      =   7236
   Begin VB.CommandButton cmdCls 
      Caption         =   "Очистить"
      Height          =   495
      Left            =   5400
      TabIndex        =   3
      Top             =   3960
      Width           =   1095
   End
   Begin VB.TextBox txtX 
      Height          =   375
      Left            =   4440
      TabIndex        =   2
      Top             =   3960
      Width           =   615
   End
   Begin VB.CommandButton cmd1 
      Caption         =   "График"
      Height          =   495
      Left            =   720
      TabIndex        =   1
      Top             =   3960
      Width           =   1095
   End
   Begin VB.PictureBox picGraph 
      BackColor       =   &H00FFFFFF&
      Height          =   3255
      Left            =   480
      ScaleHeight     =   3204
      ScaleWidth      =   6204
      TabIndex        =   0
      Top             =   360
      Width           =   6255
   End
   Begin VB.Label lblX 
      Alignment       =   2  'Center
      BackColor       =   &H00C0FFC0&
      Caption         =   "Максимальная координата X"
      Height          =   252
      Left            =   1920
      TabIndex        =   4
      Top             =   3960
      Width           =   2412
   End
End
Attribute VB_Name = "frm1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim intX, intJ, intI, intY(1 To 10000) As Integer
Private Sub cmd1_Click()
'заполнение массива
intI = 1
intX = -Val(txtX)
Do While intX < Val(txtX)
intY(intI) = intX ^ 3
intX = intX + 0.01
intI = intI + 1
Loop
'поиск минимального элемента
intMin = intY(1)
For intI = 2 To 10000
If intY(intI) < intMin Then intMin = intY(intI): intN = intI
Next intI
'поиск максимального элемента
intMax = intY(1)
For intI = 2 To 10000
If intY(intI) > intMax Then intMax = intY(intI): intN = intI
Next intI
'Установка масштаба
picGraph.Scale (-Val(txtX), intMax)-(Val(txtX), intMin)
'Построение графика
intI = 1
intX = -Val(txtX)
Do While intX < Val(txtX)
intY(intI) = intX ^ 3
picGraph.PSet (intX, intY(intI))
intX = intX + 0.01
intI = intI + 1
Loop
'Ось Х
picGraph.Line (-Val(txtX), 0)-(Val(txtX), 0)
For intJ = -Val(txtX) To Val(txtX) Step Val(txtX) / 10
picGraph.PSet (intJ, 0)
picGraph.Print intJ
Next intJ
'Ось Y
picGraph.Line (0, intMax)-(0, intMin)
For intJ = intMin To intMax Step intMax / 5
picGraph.PSet (0, intJ)
picGraph.Print Int(intJ)
Next intJ
End Sub
Private Sub cmdCls_Click()
picGraph.Cls
End Sub
