Skip to content

Commit 7d8e2bf

Browse files
Merge pull request #393 from MaksimLahtin/laba6
Laba6
2 parents 8f55b2a + ddba8e6 commit 7d8e2bf

3 files changed

Lines changed: 42 additions & 5 deletions

File tree

golang/lab4/lab4.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ func TaskB(xv []float64) []float64 {
2525
}
2626
return yValues
2727
}
28+
2829
func RunLab4() {
2930
var xn float64 = 0.26
3031
var xk float64 = 0.66
3132
var xdel float64 = 0.08
3233
var xv []float64 = []float64{0.1, 0.35, 0.4, 0.55, 0.6}
33-
3434
var resultA []float64 = TaskA(xn, xk, xdel)
3535
fmt.Println(resultA)
3636
var resultB []float64 = TaskB(xv)

golang/lab6/lab6.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package lab6
2+
3+
import "fmt"
4+
5+
type Person struct {
6+
Class string
7+
Lvl int
8+
Weapon string
9+
}
10+
11+
func NewPerson(class string, lvl int, weapon string) *Person {
12+
pers := new(Person)
13+
pers.Class = class
14+
pers.Lvl = lvl
15+
pers.Weapon = weapon
16+
return pers
17+
}
18+
19+
func (pers *Person) SetLvl(lvl int) {
20+
pers.Lvl = lvl
21+
}
22+
23+
func (pers Person) GetLvl() int {
24+
return pers.Lvl
25+
}
26+
27+
func (pers Person) GetWeapon() string {
28+
return pers.Weapon
29+
}
30+
31+
func RunLab6() {
32+
pudge := NewPerson("Pudge", 20, "Hook")
33+
pudge.SetLvl(30)
34+
fmt.Println(pudge.GetLvl())
35+
fmt.Println(pudge.GetWeapon())
36+
}

golang/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package main
22

33
import (
44
"fmt"
5-
5+
"isuct.ru/informatics2022/lab6"
66
"isuct.ru/informatics2022/lab4"
77
)
88
func main() {
9-
lab4.RunLab4()
10-
fmt.Println("Лахтин Максим Сергеевич")
11-
}
9+
fmt.Println("Лахтин Максим Сергеевич")
10+
lab4.RunLab4()
11+
lab6.RunLab6()
12+
}

0 commit comments

Comments
 (0)