lkejfl
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
module main.go
|
||||
|
||||
go 1.24.4
|
||||
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
||||
type Cicle struct {
|
||||
radius int
|
||||
}
|
||||
|
||||
type Rectangle struct {
|
||||
lenght,width int
|
||||
}
|
||||
|
||||
func (circle Cicle) Perim() float64 {
|
||||
return float64(circle.radius) * math.Pi
|
||||
}
|
||||
|
||||
|
||||
func main() {
|
||||
c := Cicle{
|
||||
radius: 3,
|
||||
}
|
||||
fmt.Println(c.Perim())
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
module main.go
|
||||
|
||||
go 1.24.4
|
||||
@@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
|
||||
type Employee struct {
|
||||
name string
|
||||
position string
|
||||
salary int
|
||||
currency string
|
||||
}
|
||||
|
||||
func (e Employee) DisplayInfo() {
|
||||
fmt.Println("Name: ", e.name)
|
||||
fmt.Println("Position: ",e.position)
|
||||
fmt.Printf("Salary: %d %s\n",e.salary,e.currency)
|
||||
}
|
||||
|
||||
func main(){
|
||||
emp := Employee {
|
||||
name: "Bob",
|
||||
position: "senior",
|
||||
salary: 10000,
|
||||
currency: "RUB",
|
||||
}
|
||||
emp.DisplayInfo()
|
||||
}
|
||||
Reference in New Issue
Block a user