. Visual Basic : For... Next, , Do... Loop, .
For...Next :
For ˳ = ʳ
Next ˳
˳ . ˳ 1 . (, 䒺 ) ʳ , . г , , .
: 1 10.
Private Sub Command1_Click()
For i = 1 To 10
Print i
Next i
End Sub
Exit For.
Do...Loop
, Do... Loop. Do...Loop.
,
D {While | Until}
Loop
,
Do
Loop {While | Until}
, . , , , . Do... Loop .
While...Wend
While... Wend .
While
Wend
䳿 , Do While.. Loop. Do... Loop. , While...Wend Exit.
Private Sub Command1_Click()
While x = True
Print Time
Wend
End Sub
: 20.
Private Sub Command1_Click()
For i = 1 To 9
For j = 1 To 9
For k = 1 To 9
s = i + j + k
If s = 20 Then Print i; j; k
Next k
Next j
Next i
End Sub
:
Private Sub Command1_Click()
h = (1 - 0) / 20
For x = 0 To 1 Step h
s = s + Exp(x)
Next x
Label2.Caption = Str(s * h)
End Sub
.
Private Sub Command1_Click()
s = 1: x = 1
n = 1: y = 0.1
f = 1
e = 0.001
While y >= e
For i = 1 To n
f = f * i
Next i
y = x ^ n / f
s = s + y
n = n + 1
f = 1
Wend
Label2.Caption = Str(s)
End Sub
.
1. ?
2. ?
.
1. 1 10.
|
|
2. 1 10.
3.
.
4.
y = sin(nx) - cos(n/x) n = 1,2,...,50.
5. 0.1
Y = X arctg n
, 2 5 0,1. .
6. :
ae Sin x +Cosx, < -5;
y = Cos2x+Sin2x, -5 < < 5;
ab lg(bx), > 5,
x [-10; 10] 1.
7. :
lg3 a2 + / e x x < 3;
y = + 1/x 3 < x < 7
a Cos2 (e) + a Sin2(aex) x > 7.
x [0; 10] 0.5.
8. = os(x) , 0 1800 50.
9. ϳ N.
10.
s=1+x/5+x/7+x/9+ ..
11. e .
1. S = - + - +...; x = 0.2; e =
2. S = x - + - +...; x = 0.1; e =
5