.


:




:

































 

 

 

 


Do. Loop




 

Do. Do , .

Do , , , .

 

Do... Loop :

 

While. . , .

 

Do While

[_]

Loop

Until. . , .

 

Do Until

[_]

Loop

 

Do... Loop :

 

Do

[_]

Loop While

 

Do

[_]

Loop Until

 

 

, DoLoop :

  Δ
- parametr = shag = DO [ ] parametr = parametr + shag LOOP WHILE   parametr = shag = DO [ ] parametr = parametr + shag LOOP UNTIL  
- parametr = shag = DO WHILE [ ] parametr = parametr + shag LOOP   parametr = shag = DO UNTIL [ ] parametr = parametr + shag LOOP  

 

parametr , ( ); shag .

 

. 4.

While ( ):

 

Sub Demo_Do_While_Loop()

Dim xStart, xEnd, xStep As Integer

Dim x As Integer

Dim i As Integer

Dim xradian, y As Single

xStart = Cells(2, 2)

xEnd = Cells(3, 2)

xStep = Cells(4, 2)

i = 1

x = xStart

' x<= 40 :

Do While x <= 40

xradian = 3.14 * x / 180

y = (2.51 * Sin(xradian) / (2 + 3 * Cos(xradian)) ^ (1 / 3))

i = i + 1

Cells(i, 4) = x

Cells(i, 5) = y

x = x + xStep

'

Loop

End Sub

 

While ( ):

 

Sub Demo_Do_Loop_While()

Dim xStart, xEnd, xStep As Integer

Dim x As Integer

Dim i As Integer

Dim xradian, y As Single

xStart = Cells(2, 2)

xEnd = Cells(3, 2)

xStep = Cells(4, 2)

i = 1

x = xStart

'

Do

xradian = 3.14 * x / 180

y = (2.51 * Sin(xradian) / (2 + 3 * Cos(xradian)) ^ (1 / 3))

i = i + 1

Cells(i, 4) = x

Cells(i, 5) = y

x = x + xStep

' , x<= 40

Loop While x <= 40

End Sub

 

Until ( ):

 

Sub Demo_Do_Until_Loop()

Dim xStart, xEnd, xStep As Integer

Dim x As Integer

Dim i As Integer

Dim xradian, y As Single

xStart = Cells(2, 2)

xEnd = Cells(3, 2)

xStep = Cells(4, 2)

i = 1

x = xStart

' , x 40

Do Until x > 40

xradian = 3.14 * x / 180

y = (2.51 * Sin(xradian) / (2 + 3 * Cos(xradian)) ^ (1 / 3))

i = i + 1

Cells(i, 4) = x

Cells(i, 5) = y

x = x + xStep

'

Loop

End Sub

 

Until ( ):

 

Sub Demo_Do_Until_Loop()

Dim xStart, xEnd, xStep As Integer

Dim x As Integer

Dim i As Integer

Dim xradian, y As Single

xStart = Cells(2, 2)

xEnd = Cells(3, 2)

xStep = Cells(4, 2)

i = 1

x = xStart

'

Do

xradian = 3.14 * x / 180

y = (2.51 * Sin(xradian) / (2 + 3 * Cos(xradian)) ^ (1 / 3))

i = i + 1

Cells(i, 4) = x

Cells(i, 5) = y

x = x + xStep

' , x 40

Loop Until x > 40

End Sub

 

. n, .

 

.

 

Sub n()

Dim n As Integer

n = 1

' , :

Do While 4 * n ^ 3 - n ^ 2 + 3 * n < 250000000#

n = n + 1

Loop

MsgBox " " & n - 1,, " "

End Sub

 





:


: 2015-10-27; !; : 579 |


:

:

- , - .
==> ...

1240 - | 1186 -


© 2015-2024 lektsii.org - -

: 0.016 .