: ,
:
Dim n As Integer, i As Integer
Dim x() As Single
Private Sub CmdTest_Click()
Dim newline As String, elements As String
newline = Chr(13) + Chr(10)
TxtX.Text = " :" + newline
For i = 1 To n
TxtX.Text = TxtX.Text + Format(x(i), "0.0 ")
Next i
End Sub
Private Sub CmdVvod_Click()
CmdTest.Enabled = True
CmdWork.Enabled = True
n = Val(InputBox(" ", " "))
ReDim x(n)
If OpbHand.Value = True Then
For i = 1 To n
x(i) = Val(InputBox(" " & i & "- ", " "))
Next i
Else
For i = 1 To n
x(i) = Int(n * Rnd - n / 2)
Next i
End If
CmdVvod.Caption = " !"
End Sub
Private Sub CmdWork_Click()
Dim Sum As Single, Product As Single
If ChbSum.Value = 1 Then
Sum = 0
For i = n To 1 Step -1
If x(i) > 0 Then
k = x(i)
Exit For
End If
Next i
Sum = 0
For i = 1 To n
If x(i) > k Then
Sum = Sum + x(i)
End If
Next i
LblSum.Text = Sum
Else
LblSum.Text = ""
End If
End Sub
Private Sub CmdReset_Click()
CmdTest.Enabled = False
CmdWork.Enabled = False
CmdVvod.Caption = " ..."
CmdVvod.SetFocus
TxtX.Text = ""
LblSum.Text = ""
Sum = 0
For i = 1 To n
x(i) = 0
Next i
End Sub
, :
Dim (1[,2]) [As ],
- , ;
ReDim (1[,2])
Option Base
Option Base {0 | 1}
For Each...Next .
For Each In
[Exit For]
Next []
( For...Next DoLoop For...Each...Next ):
For I = 1 To 10
For J = 1 To 10
For K = 1 To 10
...
Next K
Next J
Next I
:
5
.
: 3
:
|
|
Dim n As Integer, m As Integer
Dim a() As Single
Public Sub vivod_Msg()
'
For i = 1 To n
For j = 1 To m
st$ = st$ & Format(a(i, j), "##") & " "
Next j
st$ = st$ & Chr(13)
Next i
MsgBox "" & Chr(13) & " " & st$
End Sub