Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions golang/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module isuct.ru/informatics2022

go 1.16

require github.com/stretchr/testify v1.8.1
17 changes: 0 additions & 17 deletions golang/go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +0,0 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
50 changes: 50 additions & 0 deletions golang/internal/sample.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
package internal

import (
"fmt"
"math"
)

func Summ(a, b int) int {
return a + b
}

func log(base, x float64) float64 {
return math.Log(x) / math.Log(base)
}
func func_res(x float64) float64 {
return (4.1*math.Cbrt(x) - 2.7*log(5, x)) / math.Pow(math.Log10(x-1), 3)
}

func Task_A(x_start, x_end, x_step float64) []float64 {
var capacity float64 = (x_end - x_start) / x_step
var capacity_int int = int(capacity)
answer_a := make([]float64, 0, capacity_int)
for i := x_start; i <= x_end; i += x_step {
answer_a = append(answer_a, func_res(i))
}
return answer_a
}

func Task_B(slice_of_x_values []float64) []float64 {
answer_b := make([]float64, 0, len(slice_of_x_values))
for _, i := range slice_of_x_values {
answer_b = append(answer_b, func_res(i))
}
return answer_b
}

type City struct {
Country string
Population uint
NameCity string
}

func (c *City) Output() {
fmt.Println("Страна:", c.Country)
fmt.Println("Население:", c.Population)
fmt.Println("Город:", c.NameCity)
}

func (c *City) SetCountry(country string) {
c.Country = country
}

func (c *City) GetCountry() string {
return c.Country
}
15 changes: 13 additions & 2 deletions golang/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
package main

import "fmt"
import (
"fmt"

"isuct.ru/informatics2022/internal"
)

func main() {
fmt.Println("Hello world")
fmt.Println("Орлова Екатерина Евгеньевна, 1/278")
fmt.Println(internal.Task_A(1.5, 3.5, 0.4))
fmt.Println(internal.Task_B([]float64{1.9, 2.15, 2.34, 2.74, 3.16}))

c := internal.City{Country: "Россия", Population: 360687, NameCity: "Иваново"}
c.SetCountry("Норвегия")
fmt.Println(c.GetCountry())
c.Output()
}