Browse Source

index0

pull/1/head
dewjjj 8 months ago
parent
commit
e6b301e567
  1. 11
      boiling0/boiling0.go
  2. 13
      boiling1/boiling1.go
  3. 14
      index0/index0.go

11
boiling0/boiling0.go

@ -0,0 +1,11 @@
package main
import "fmt"
const boilingF = 212.0
func main() {
var f = boilingF
var c = (f - 32) * 5 / 9
fmt.Printf("boiling poing = %g°F or %g°C\n", f, c)
}

13
boiling1/boiling1.go

@ -0,0 +1,13 @@
package main
import "fmt"
func main() {
const freezingF, boilingF = 32.0, 212.0
fmt.Printf("%g°F = %g°C\n", freezingF, fToC(freezingF))
fmt.Printf("%g°F = %g°C\n", boilingF, fToC(boilingF))
}
func fToC(f float64) float64 {
return (f - 32) * 5 / 9
}

14
index0/index0.go

@ -0,0 +1,14 @@
package main
import "fmt"
func main() {
v := 1
incr(&v)
fmt.Println(incr(&v))
}
func incr(p *int) int {
*p++
fmt.Println(p)
return *p
}
Loading…
Cancel
Save