Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
123456789.docx
Скачиваний:
1
Добавлен:
29.07.2019
Размер:
36.04 Кб
Скачать

Private Sub Command1_Click()

Dim x,y(100) as single

Open “C:\inf\input.txt” for input as #1

SUB calcule (a, b, r, x(), y(), n, calc)

SUB pnt (x(), y(), n, a, b, r, calc, x1, y1, x2, y2)

Input #1,a , b, r, n, x1, y1, x2, y2

For i=1 to n

Input #1, x(i), y(i)

Next i

Close #1

Calc = 0

Call calcule(a, b, r, x(), y(), n, calc)

Call pnt(x(), y(), n, a, b, r, calc, x1, y1, x2, y2)

End Sub

Private Sub calcule(a, b, r, x, y, n, calc)

For i = 1 To n

If (x(i)-a)^2+(y(i)-b)^2<r^2 Then calc = calc + 1

Next i

Print "calcule"

End Sub

Private Sub pnt(x, y, n, a, b, r, calc, x1, y1, x2, y2)

Form1.BackColor = RGB(100, 100, 100)

Form1.BackColor = vbBlue

Form1.CurrentX = 50

Form1.CurrentY = 50

Print "number of points: "; calc

Line (0, 3000)-(5000, 3000), vbRed

Line (2500, 0)-(2500, 5000), vbRed

Form1.CurrentX = 4900

Form1.CurrentY = 2700

Print "x"

Form1.CurrentX = 2600

Form1.CurrentY = 200

Print "y"

Line (x1, y1)-(x2, y2), , B

Circle (a, b), r, vbGreen

For i = 1 To n

PSet (x(i), y(i)), vbYellow

Next i

End Sub

Private Sub Command2_Click()

Dim x,y(100) as single

Open “C:\inf\input.txt” for input as #1

SUB calcule (a, b, r, x(), y(), n, calc)

SUB pnt (x(), y(), n, a, b, r, calc, x1, y1, x2, y2)

Input #1,a , b, r, r2, n, x1, y1, x2, y2

For i=1 to n

Input #1, X(I), y(I)

Next i

Close #1

Calc = 0

Call calcule(a, b, r, x(), y(), n, calc)

Call pnt(x(), y(), n, a, b, r, calc, x1, y1, x2, y2)

End Sub

Private Sub calcule(a, b, r, x, y, n, calc)

For i = 1 To n

If r^2<(x(i)-a)^2+(y(i)-b)^2 and (x(i)-a)^2+(y(i)-b)^2<r2^2 Then calc = calc + 1

Next i

Print "calcule"

End Sub

Private Sub pnt(x, y, n, a, b, r, calc, x1, y1, x2, y2)

Form1.BackColor = RGB(100, 100, 100)

Form1.BackColor = vbBlue

Form1.CurrentX = 50

Form1.CurrentY = 50

Print "number of points: "; calc

Line (0, 3000)-(5000, 3000), vbRed

Line (2500, 0)-(2500, 5000), vbRed

Form1.CurrentX = 4900

Form1.CurrentY = 2700

Print "x"

Form1.CurrentX = 2600

Form1.CurrentY = 200

Print "y"

Line (x1, y1)-(x2, y2), , B

Circle (a, b), r, vbGreen

Circle (a, b), r2, vbGreen

For i = 1 To n

PSet (x(i), y(i)), vbYellow

Next i

End Sub

Private Sub Command3_Click()

Dim x,y(100) as single

Open “C:\inf\input.txt” for input as #1

SUB calcule (a, b, x(), y(), n, calc)

SUB pnt (x(), y(), n, a, b, calc, x1, y1, x2, y2)

Input #1,a , b, n, x1, y1, x2, y2

For i=1 to n

Input #1, X(I), y(I)

Next i

Close #1

Calc = 0

Call calcule(a, b, r, x(), y(), n, calc)

Call pnt(x(), y(), n, a, b, r, calc, x1, y1, x2, y2)

End Sub

Private Sub calcule(a, b, r, x, y, n, calc)

For i = 1 To n

If x(i)<3.141592 and y(i)<sin(x(i*180/3.14))Then calc = calc + 1

Next i

Print "calcule"

End Sub

Private Sub pnt(x, y, n, a, b, calc, x1, y1, x2, y2)

Form1.BackColor = RGB(100, 100, 100)

Form1.BackColor = vbBlue

Form1.CurrentX = 50

Form1.CurrentY = 50

Print "number of points: "; calc

Line (0, 3000)-(5000, 3000), vbRed

Line (2500, 0)-(2500, 5000), vbRed

Form1.CurrentX = 4900

Form1.CurrentY = 2700

Print "x"

Form1.CurrentX = 2600

Form1.CurrentY = 200

Print "y"

Line (x1, y1)-(x2, y2), , B

For i=1 to 5000

PSet(i, int(sin(i*3.14/180))

Next i

For i = 1 To n

PSet (x(i), y(i)), vbYellow

Next i

End Sub

Private Sub Command4_Click()

Dim r, x, y(100) as single

Open “C:\inf\input.txt” for input as #1

SUB calcule (a, b, r(), x(), y(), n, calc)

SUB pnt (x(), y(), n, a, b, r, calc, x1, y1, x2, y2)

Input #1,a , b, r2, n, x1, y1, x2, y2

For i=1 to n

Input #1, x(i), y(i), r(i)

Next i

Close #1

Calc = 0

Call calcule(a, b, r(), x(), y(), n, calc)

Call pnt(x(), y(), n, a, b, r(), calc, x1, y1, x2, y2)

End Sub

Private Sub calcule(a, b, r(), x, y, n, calc)

For i = 1 To n

If (r2+r(i))^2 <(x(i)+y(i))^2 and (x(i)+y(i))^2>(r2-r(i))^2 Then calc = calc + 1

Next i

Print "calcule"

End Sub

Private Sub pnt(x, y, n, a, b, r(), calc, x1, y1, x2, y2)

Form1.BackColor = RGB(100, 100, 100)

Form1.BackColor = vbBlue

Form1.CurrentX = 50

Form1.CurrentY = 50

Print "number of points: "; calc

Line (0, 3000)-(5000, 3000), vbRed

Line (2500, 0)-(2500, 5000), vbRed

Form1.CurrentX = 4900

Form1.CurrentY = 2700

Print "x"

Form1.CurrentX = 2600

Form1.CurrentY = 200

Print "y"

Line (x1, y1)-(x2, y2), , B

Circle (0, 0), r2, vbGreen

For i = 1 To n

Circle (x(i), y(i)), r(i), vbGreen

Next i

End Sub

Private Sub Command5_Click()

Dim r, x, y(100) as single

Open “C:\inf\input.txt” for input as #1

SUB calcule (a, b, r(), x(), y(), n, calc)

SUB pnt (x(), y(), n, a, b, r, calc, x1, y1, x2, y2)

Input #1,a , b, n

For i=1 to n

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]