From 6d8098a65ccc87f4f64787489defd0236929752f Mon Sep 17 00:00:00 2001 From: Artemiy Druzhkov <145680939+amdruzh@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:18:52 +0300 Subject: [PATCH 1/2] Add files via upload --- calculate.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 calculate.go diff --git a/calculate.go b/calculate.go new file mode 100644 index 00000000..877eddf2 --- /dev/null +++ b/calculate.go @@ -0,0 +1,28 @@ +package lab4 + +import ( + "fmt" + "math" +) + +func CalculateY(a, b, x, xk float64) float64 { + numerator := math.Pow(a, 2) - math.Pow(b, 2) + denominator := math.Log10(a / b) + power := math.Sqrt(a * b) + + y := numerator / denominator * math.Pow(3, power) + determinant := xk - x + x2 := x + determinant/4 + x3 := x + determinant/2 + x4 := x + (3*determinant)/4 + x5 := xk + + fmt.Println("y =", y) + fmt.Println("x =", x) + fmt.Println("x2 =", x2) + fmt.Println("x3 =", x3) + fmt.Println("x4 =", x4) + fmt.Println("x5 =", x5) + + return y +} From 01f5f992132a8355f39a5add7cee39e75b378ccc Mon Sep 17 00:00:00 2001 From: Artemiy Druzhkov <145680939+amdruzh@users.noreply.github.com> Date: Wed, 17 Jan 2024 23:21:45 +0300 Subject: [PATCH 2/2] Add files via upload --- Struct.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Struct.go diff --git a/Struct.go b/Struct.go new file mode 100644 index 00000000..89ade775 --- /dev/null +++ b/Struct.go @@ -0,0 +1,33 @@ +package main + +import "fmt" + +type Television struct { + Brand string + Model string + Channel int +} + +func (tv *Television) SetChannel(channel int) { + tv.Channel = channel +} + +func (tv *Television) GetChannel() int { + return tv.Channel +} + +func (tv *Television) Display() { + fmt.Printf("Телевизор %s %s находится на канале %d\n", tv.Brand, tv.Model, tv.Channel) +} + +func main() { + tv := Television{ + Brand: "Samsung", + Model: "QLED", + Channel: 1, + } + + tv.Display() + tv.SetChannel(5) + tv.Display() +}