11 3
.docxЗадание №11 (3)
Sub tutor()
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles Button1.Click
Dim x As Integer, y As Single
x = CInt(InputBox("x="))
If x <= 0 Then y = | x |
If 0 <= x <= 1 Then y = -Math.Sin(2 * 3.14 * x) / (2 * 3.14)
If x > 1 Then y = 1 - x
MsgBox ("y=" + CStr(y))
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles Button2.Click
End
End Sub
End Class
End Sub
Задание №12
Sub tutor()
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles_
Button1.Click
Dim a As Single, b As Single, h As Single
Dim x As Single, y As Single
a = CSng(TextBox1.Text)
b = CSng(TextBox2.Text)
h = CSng(TextBox3.Text)
ListBox1.Items.Clear()
ListBox2.Items.Clear()
For x = a To b Step h
If x < 0.2 Then
y = -Math.Cos(5 * 3.14) * (x - 0.2)
ElseIf x >= 0.4 Then
y = 3
Else
y = 1 - 2 * Math.Cos(5 * 3.14) * (x - 0.2)
End If
ListBox1.Items.Add (CStr(x))
ListBox2.Items.Add (CStr(y))
Next x
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles_
Button2.Click
End
End Class
End Sub
Блок-схема алгоритма к
заданию № 12
ВВОД:
x
0≤x≤1
ВЫВОД:
Y
НАЧАЛО
y=|x|
y=
- sin (2πx)
/ (2π)
y=1-x
Блок-схема алгоритма к
заданию № 11, пункт 3
КОНЕЦ
нет
да
нет
да
x≤0
