Информатика. Основы программирования на VISUAL BASIC 6.0. Индришенок В.И - 24 стр.

UptoLike

26
через меню View\Code или через контекстное меню в проводнике
проектов при выделенной форме).
Программный код для приведенного примера:
Option Explicit
Public a As Double
Public l As Integer
Const Pi As Double = 3.141593
‘--------------------------------
Public Function Volume(R1, R2, h As
Double) As Double
Dim V As Double
V = Pi * (R1 ^ 2 – R2 ^ 2) * h
Volume = V
End Function
‘----------------------------------
Public Sub Sum(ByVal Rr1 As Double, ByVal
Rr2 As Double)
Static k, summa As Integer
Rr1 = Rr1 - Rr2
k = k + 1
F2_Cylinder.txtOutN = Str(k)
summa = Rr1 + summa
F2_Cylinder.txtOutMed = Str(summa / k)
End Sub
‘----------------------------------
Private Sub CommButSt_Click()
Dim Rad1, Rad2, Height As Double
Rad1 = Val(txtR1)
Rad2 = Val(txtR2)
Height = Val(txtH)
a = Volume(Rad1, Rad2, Height)
F2_Cylinder.Show
Call Sum(Rad1, Rad2)
F2_Cylinder.txtOutVal = Str(a)
F1_Cylinder.CommButSt.Visible = False
End Sub
‘----------------------------------
Private Sub CommButOut_Click()
                             26

через меню View\Code или через контекстное меню в проводнике
проектов при выделенной форме).
Программный код для приведенного примера:
      Option Explicit
      Public a As Double
      Public l As Integer
      Const Pi As Double = 3.141593
      ‘--------------------------------
      Public Function Volume(R1, R2, h As
      Double) As Double
      Dim V As Double
      V = Pi * (R1 ^ 2 – R2 ^ 2) * h
      Volume = V
      End Function
      ‘----------------------------------
      Public Sub Sum(ByVal Rr1 As Double, ByVal
      Rr2 As Double)
      Static k, summa As Integer
      Rr1 = Rr1 - Rr2
      k = k + 1
      F2_Cylinder.txtOutN = Str(k)
      summa = Rr1 + summa
      F2_Cylinder.txtOutMed = Str(summa / k)
      End Sub
      ‘----------------------------------
      Private Sub CommButSt_Click()
      Dim Rad1, Rad2, Height As Double
      Rad1 = Val(txtR1)
      Rad2 = Val(txtR2)
      Height = Val(txtH)
      a = Volume(Rad1, Rad2, Height)
      F2_Cylinder.Show
      Call Sum(Rad1, Rad2)
      F2_Cylinder.txtOutVal = Str(a)
      F1_Cylinder.CommButSt.Visible = False
      End Sub
      ‘----------------------------------
      Private Sub CommButOut_Click()