1 Star 0 Fork 0

暗夜之学 / gostudy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 306 Bytes
一键复制 编辑 原始数据 按行查看 历史
hanjian 提交于 2020-11-15 23:05 . effective
package main
import (
"fmt"
"math"
)
type Vertex struct {
X, Y float64
}
func Abs(v Vertex) float64 {
return math.Sqrt(v.X*v.X + v.Y*v.Y)
}
func Scale(v Vertex, f float64) Vertex {
v.X = v.X * f
v.Y = v.Y * f
return v
}
func main() {
v := Vertex{3, 4}
v = Scale(v, 10)
fmt.Println(Abs(v))
}
Go
1
https://gitee.com/lovehei/gostudy.git
git@gitee.com:lovehei/gostudy.git
lovehei
gostudy
gostudy
73c713180039

搜索帮助