Код лабы 4.3
.docxКод программы! Тема 4.3
Option Strict On
Option Explicit On
Imports System.Math
Public Class Form1
Function input(ByVal T As TextBox) As Single ' Процедура-Function выполняет ввод переменной в TextBox
Return CSng(Val(T.Text))
End Function
Sub output(ByVal W As Single, ByVal T As TextBox) ' Процедура-Sub выполняет вывод переменой в TextBox
T.Text = CStr(W)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'завершение программы
End
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click 'очистить поля ввода
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
TextBox7.Clear()
End Sub
Function dlina(ByVal x As Single, ByVal y As Single) As Single 'Вычисление длины стороны, полученной из теоремы синусов
Dim l As Single
l = CSng(Sin(y) * 2 * x)
Return l
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a1 As Single, b1 As Single, c1 As Single
Dim r1 As Single
Dim a As Single, b As Single, c As Single
a1 = input(TextBox1) 'ввод значения углов и радиуса
b1 = input(TextBox2)
c1 = input(TextBox3)
r1 = input(TextBox4)
a = dlina(r1, a1) 'вычисление длин сторон
b = dlina(r1, b1)
c = dlina(r1, c1)
output(a, TextBox5) 'вывод значения длин сторон в элементы TextBox
output(b, TextBox6)
output(c, TextBox7)
End Sub
Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click
End Sub
End Class