INTERNET
 :
  |    

/

, . /

10 : Visual Basic

1 | 2 | 3 | 4 | 5 | 6

5

1

 

DIM- .

Dim String as Type

String -

Type -

Byte

1

0-255

Integer

2

+ 32768

Long

4

+ 2 .

Double

4

.

+10+304

String

Len(String)

0-~64000

Boolean

2

True/False

1;0

Variant

16

.

2

Sub ( )

Dim S As String, Pr As String

Dim nPr As Integer, i As Long

S = InputBox(" ")

Pr = ",.?!:;"

nPr = 0

For i = 1 To Len(S)

If (InStr(Pr, Mid(S, i, 1))) > 0 Then

nPr = nPr + 1

End If

Next i

MsgBox ("- =" + Str(nPr))

End Sub

3

Sub Swap(S As String, i As Long, j As Long)

Dim c As String

c = Mid(S, i, 1)

Mid(S, i, 1) = Mid(S, j, 1)

Mid(S, j, 1) = c

End Sub

Sub ( )

Dim S As String, Sh As String

Dim S1 As String, c As String

Dim Gl As String, K As Long

Dim i As Long

Sh = ""

S = InputBox(" ")

Gl = ""

For i = 1 To Len(S)

c = Mid(S, i, 1)

S1 = S1 + c

If InStr(Gl, c) > 0 Then

K = K + 1

If K > Len(Sh) Then K = 1

S1 = S1 + Mid(Sh, K, 1)

End If

Next i

For i = 1 To Len(S1) - 1 Step 2

Call Swap(S1, i, i + 1)

Next i

For i = 1 To Len(S1) - 2 Step 3

Call Swap(S1, i, i + 2)

Next i

S = S1

MsgBox (S)

End Sub

4

Sub ( )

Dim S As String, i As Long

Dim S1 As String, c As String

Dim Gl As String, K As Long

S = InputBox(" ")

Gl = ""

For i = 1 To Len(S) - 2 Step 3

Call Swap(S, i, i + 2)

Next i

For i = 1 To Len(S) - 1 Step 2

Call Swap(S, i, i + 1)

Next i

For i = 1 To Len(S)

c = Mid(S, i, 1)

S1 = S1 + c

If InStr(Gl, c) > 0 Then i = i + 1

Next i

MsgBox (S1)

End Sub

5

Sub ()

Dim S As String, S1 As String

Dim n As Long, C As String

S = InputBox(" ")

n = 0

For i = 1 To Len(S)

C = Mid(S, i, 1)

If Mid(S, i, 1) = "&" Then

S1 = S1 + ""

n = n + 1

ElseIf Mid(S, i, 3) = "" Then

S1 = S1 + ""

i = i + 2

n = n + 1

Else

S1 = S1 + C

End If

Next i

MsgBox (S1)

MsgBox (n)

End Sub


Copyright © 2005—2007 «RefStore.Ru»