Массив 30 на 20 строка 111 строка 00000
Массив 30 на 20 строка 111 строка 00000
Private Sub Command1_Click()
Dim a(30, 20) As Integer
For i = 1 To 20 Step 2
For j = 1 To 30
a(j, i) = 1
Next j
Next i
For i = 1 To 20
For j = 1 To 30 Step 2
a(j, 1) = 1
Next j
Next i
For i = 1 To 20
For j = 1 To 30
Print a(j, i);
Next j
Next i
End Sub
Массив 5 на 5
Private Sub Command1_Click()
Dim A(5, 5) As Integer
For i = 1 To 4
A(3, 6 - i) = i
Next i
For N = 1 To 5
For K = 1 To 5
Print A(K, N);
Next K
Next N
End Sub
Русует окружность
Private Sub Pic1_Click()
Dim x As Integer
Dim y As Integer
Dim R As Integer
x = InputBox("x")
y = InputBox("y")
R = InputBox("R")
Pic1.Circle (x, y), R
End Sub
Суммирует два массива во второй
Private Sub Command1_Click()
Dim A(5, 5) As Integer
Dim B(5, 5) As Integer
For i = 1 To 5
For k = 1 To 5
A(i, k) = 10
B(i, k) = 20
Next k
Next i
For i = 1 To 5
For k = 1 To 5
B(i, k) = A(i, k) + B(i, k)
Print B(i, k);
Next k
Next i
End Sub
Написать функцию которая вычисляет объем цилиндра параметрами функциями должны быть радиус и высота цилиндра
Private Sub Command1_Click()
A = InputBox("радиус")
B = InputBox("высота")
Print V(A, B)
End Sub
Function V(A, B)
P = 3.14
V = P * (A * A) * B
End Function
Написать функцию которая возвращает максимальное из двух целых чисел полученных в качестве аргумента
Private Sub Command1_Click()
A = InputBox("радиус")
B = InputBox("высота")
Print Max(A, B)
End Sub
Function Max(A, B)
If A > B Then Max = A Else Max = B
End Function
Из 6 чисел выстраивает по убыванию
Private Sub Command1_Click()
a = 5
b = 6
c = 8
d = 3
e = 7
k = 2
If a > n Then n = a
If b > n Then n = b
If c > n Then n = c
If d > n Then n = d
If e > n Then n = e
If k > n Then n = k
Print n
If a > m And a < n Then m = a
If b > m And b < n Then m = b
If c > m And c < n Then m = c
If d > m And d < n Then m = d
If e > m And e < n Then m = e
If k > m And k < n Then m = k
Print m
If a > j And a < m Then j = a
If b > j And b < m Then j = b
If c > j And c < m Then j = c
If d > j And d < m Then j = d
If e > j And e < m Then j = e
If k > j And k < m Then j = k
Print j
If a > p And a < j Then p = a
If b > p And b < j Then p = b
If c > p And c < j Then p = c
If d > p And d < j Then p = d
If e > p And e < j Then p = e
If k > p And k < j Then p = k
Print p
If a > l And a < p Then l = a
If b > l And b < p Then l = b
If c > l And c < p Then l = c
If d > l And d < p Then l = d
If e > l And e < p Then l = e
If k > l And k < p Then l = k
Print l
If a > s And a < l Then s = a
If b > s And b < l Then s = b
If c > s And c < l Then s = c
If d > s And d < l Then s = d
If e > s And e < l Then s = e
If k > s And k < l Then s = k
Print s
End Sub
Четыре дуги
Dim pi!
Private Sub Command1_Click()
p1.Cls
pi = 3.14159261
p1.Scale (-100, 100)-(100, -100)
p1.Line (-75, 0)-(75, 0), vbRed
p1.Line (0, 75)-(0, -75), vbRed
p1.Line (75, 0)-(72, 2), vbRed
p1.Line (75, 0)-(72, -2), vbRed
p1.Print "x"
p1.Line (0, 75)-(-2, 72), vbRed
p1.Line (0, 75)-(2, 72), vbRed
p1.Print "y"
p1.Circle (0, 50), 40, vbGreen, pi, 2 * pi
p1.Circle (0, -50), 40, vbGreen, 2 * pi, pi
p1.Circle (-50, 0), 40, vbGreen, 3 * pi / 2, pi / 2
p1.Circle (50, 0), 40, vbGreen, pi / 2, 3 * pi / 2
End Sub
выдает "есть" или "нет" в предложении слово с данной буквой!
S = "Барт воскликнул карамба"
J = " "
A = InputBox("Введите идентификационный номер")
K = Len(S)
For i = 1 To Len(S)
If Mid(S, i, 1) = A Then K = 1
Next i
If K = 1 Then Print "есть" Else Print "нет"
Вводишь букву считает количество букв в предложении и выводит их
S = "Барт воскликнул карамба"
A = InputBox("Введите идентификационный номер")
For i = 1 To Len(S)
If Mid(S, i, 1) = A Then
K = K + 1
End If
Next i
Print K
Переворачивает слово наоборот
A = InputBox("Введите идентификационный номер")
For i = Len(A) To 1 Step -1
Print Mid(A, i, 1);
Next i
Заполняет и выдает двумерный массив 20-30 цифрами 666
Dim A(30, 20) As Integer
For i = 1 To 20
For j = 1 To 30
A(j, i) = 666
Next j
Next i
For i = 1 To 20
For j = 1 To 30
Print A(j, i);
Next j
Next i
Заполняет и выдает двумерный массив 20-30 и заполняет весь столбец через один единицами
Dim A(30, 20) As Integer
For i = 1 To 20
For j = 1 To 30 Step 2
A(j, i) = 1
Next j
Next i
For i = 1 To 20
For j = 1 To 30
Print A(j, i);
Next j
Next i
Заполняет массив 10 на 10 диагоналями накрест единицой
Dim A(10, 10) As Integer
For j = 1 To 10
A(j, j) = 1
Next j
For j = 1 To 10
A(11 - j, j) = 1
Next j
For i = 1 To 10
For j = 1 To 10
Print A(j, i);
Next j
Next i
Заполняет и выдает двумерный массив 20-30 и заполняет весь столбец через один единицами и строчку единицами через ноль
Dim A(30, 20) As Integer
For i = 1 To 20 Step 2
For j = 1 To 30
A(j, i) = 1
Next j
Next i
For i = 1 To 20
For j = 1 To 30 Step 2
A(j, i) = 1
Next j
Next i
For i = 1 To 20
For j = 1 To 30
Print A(j, i);
Next j
Next i
Таблица умножения 7*(1-10)=(7-70) вниз в столбец
Dim A As Single
Dim K As Single
For A = 0 To 10 Step 1
Print "7 X"; A; "="; 7 * A
Next A
Таблица умножения вся в две строчки
Dim A As Single
Dim N As Single
For A = 0 To 10 Step 1
For N = 1 To 5 Step 1
Print N; "X"; A; "="; N * A,
If N = 5 Then Print
Next N
Next A
Print " "
For A = 0 To 10 Step 1
For N = 6 To 10 Step 1
Print N; "X"; A; "="; N * A,
If N = 10 Then Print
Next N
Next A
Массив из 10 символов рандомом+1 символ меняется на 2 и наоборот
Dim A(10) As Integer
Dim H As Integer
For i = 1 To 10
A(i) = Int(Rnd * 10) + 10
Next i
For i = 1 To 10
Print A(i);
Next i
H = A(2)
n = A(1)
A(2) = n
A(1) = H
print i
Рисунок малагорского клинка
Dim pi!
Private Sub Command1_Click()
P1.Cls
pi = 3.14159261
P1.Scale (-100, 100)-(100, -100)
P1.Line (-75, 0)-(75, 0), vbRed
P1.Line (0, 75)-(0, -75), vbRed
P1.Line (75, 0)-(72, 2), vbRed
P1.Line (75, 0)-(72, -2), vbRed
P1.Print "x"
P1.Line (0, 75)-(-2, 72), vbRed
P1.Line (0, 75)-(2, 72), vbRed
P1.Print "y"
P1.Circle (0, 20), 20, vborange, pi, 2 * pi
P1.Circle (0, -20), 20, vborange, 2 * pi, pi
P1.Circle (-20, 0), 20, vbotange, pi / 2, 3 * pi / 2
P1.Circle (20, 0), 20, vborange, 3 * pi / 2, pi / 2
выдает рисунок уравнения прямой и параболы с вершиной в точке (у-точка)
Dim pi!, x!
Private Sub Command1_Click()
P1.Cls
pi = 3.14159261
P1.Scale (-100, 100)-(100, -100)
P1.Line (-75, 0)-(75, 0), vbRed
P1.Line (0, 75)-(0, -75), vbRed
P1.Line (75, 0)-(72, 2), vbRed
P1.Line (75, 0)-(72, -2), vbRed
P1.Print "x"
P1.Line (0, 75)-(-2, 72), vbRed
P1.Line (0, 75)-(2, 72), vbRed
P1.Print "y"
For x = -50 To 50 Step 0.01
y = -2 * x + 7
P1.PSet (x, y)
Next x
For x = -50 To 50 Step 0.01
y = x * x
P1.PSet (x, y - 40)
Next x
End Sub
Пишет в блокноте слово dom
Private Sub Command1_Click()
Dim a As String
a = "dom"
fff = FreeFile
Open "d:\1.txt" For Output As #fff
Print #fff, a
Close #fff
End Sub
Записывает в блокнот массив
Private Sub Command1_Click()
Dim a(9, 9) As Integer
Dim B As String
fff = FreeFile
Open "d:\1.txt" For Output As #fff
Print #fff, B
For i = 1 To 4
a(5, 5 - i) = i
Next i
For N = 1 To 9
For k = 1 To 9
Print #fff, a(k, N);
Next k
Print #fff,
Next N
Close
End Sub
Массив по пириметру единицы
Private Sub Command1_Click()
Dim A(10, 10) As Integer
For i = 1 To 10
A(i, 1) = 1
A(1, i) = 1
A(10, i) = 1
A(i, 10) = 1
Next i
For N = 1 To 10
For k = 1 To 10
Print A(k, N);
Next k
Next N
End Sub
Массив 30 на 20 строка 111 строка 00000
Private Sub Command1_Click()
Dim a(30, 20) As Integer
For i = 1 To 20 Step 2
For j = 1 To 30
a(j, i) = 1
Next j
Next i
For i = 1 To 20
For j = 1 To 30 Step 2
a(j, 1) = 1
Next j
Next i
For i = 1 To 20
For j = 1 To 30
Print a(j, i);
Next j
Next i
End Sub
Массив 5 на 5
Private Sub Command1_Click()
Dim A(5, 5) As Integer
For i = 1 To 4
A(3, 6 - i) = i
Next i
For N = 1 To 5
For K = 1 To 5
Print A(K, N);
Next K
Next N
End Sub
Русует окружность
Private Sub Pic1_Click()
Dim x As Integer
Dim y As Integer
Dim R As Integer
x = InputBox("x")
y = InputBox("y")
R = InputBox("R")
Pic1.Circle (x, y), R
End Sub