代码拉取完成,页面将自动刷新
/*
package main
import "fmt"
func main() {
fmt.Println("Hello Eded.Wong")
}
*/
/*
package main
import (
"fmt"
"math/rand"
)
func main() {
fmt.Println("My favorite number is", rand.Intn(10))
}
*/
/*
package main
import (
"fmt"
"math"
)
func main() {
fmt.Printf("Now you have %g problems.", math.Nextafter(2, 3))
}
*/
/*
package main
import (
"fmt"
"math"
)
func main() {
fmt.Println(math.Pi)
}
*/
/*
package main
import "fmt"
func add(x int, y int) int {
return x + y
}
func main() {
fmt.Println(add(42, 13))
}
*/
/*
package main
import "fmt"
func add(x, y int) int {
return x + y
}
func main() {
fmt.Println(add(42, 13))
}
*/
/*
package main
import "fmt"
func swap(x, y string) (string, string) {
return y, x
}
func main() {
a, b := swap("hello", "world")
fmt.Println(a, b)
}
*/
/*
package main
import "fmt"
func split(sum int) (x, y int) {
x = sum * 4 / 9
y = sum - x
return
}
func main() {
fmt.Println(split(17))
}
*/
/*
package main
import "fmt"
var c, python, java bool
func main() {
var i int
fmt.Println(i, c, python, java)
}
*/
/*
package main
import "fmt"
var i, j int = 1, 2
func main() {
var c, python, java = true, false, "no!"
fmt.Println(i, j, c, python, java)
}
*/
/*
package main
import "fmt"
func main() {
var i, j int = 1, 2
k := 3
c, python, java := true, false, "no!"
fmt.Println(i, j, k, c, python, java)
}
*/
/*
package main
import (
"fmt"
"math/cmplx"
)
var (
ToBe bool = false
MaxInt uint64 = 1<<64 - 1
z complex128 = cmplx.Sqrt(-5 + 12i)
)
func main() {
const f = "%T(%v)\n"
fmt.Printf(f, ToBe, ToBe)
fmt.Printf(f, MaxInt, MaxInt)
fmt.Printf(f, z, z)
}
*/
/*
package main
import "fmt"
func main() {
var i int
var f float64
var b bool
var s string
fmt.Printf("%v %v %v %q\n", i, f, b, s)
}
*/
/*
package main
import (
"fmt"
"math"
)
func main() {
var x, y int = 3, 4
var f float64 = math.Sqrt(float64(x*x + y*y))
var z int = int(f)
fmt.Println(x, y, z)
}
*/
/*
package main
import "fmt"
func main() {
v := 42
fmt.Printf("v is of type %T\n", v)
}
*/
/*
package main
import "fmt"
const Pi = 3.14
func main() {
const World = "世界"
fmt.Println("Hello", World)
fmt.Println("Happy", Pi, "Day")
const Truth = true
fmt.Println("Go rules?", Truth)
}
*/
/*
package main
import "fmt"
const (
Big = 1 << 100
Small = Big >> 99
)
func needInt(x int) int { return x*10 + 1 }
func needFloat(x float64) float64 {
return x * 0.1
}
func main() {
fmt.Println(needInt(Small))
fmt.Println(needFloat(Small))
fmt.Println(needFloat(Big))
}
*/
/*
package main
import "fmt"
func main() {
sum := 0
for i := 0; i < 10; i++ {
sum += i
}
fmt.Println(sum)
}
*/
/*
package main
import "fmt"
func main() {
sum := 1
for sum < 1000 {
sum += sum
}
fmt.Println(sum)
}
*/
/*
package main
import (
"fmt"
"math"
)
func sqrt(x float64) string {
if x < 0 {
return sqrt(-x) + "i"
}
return fmt.Sprint(math.Sqrt(x))
}
func main() {
fmt.Println(sqrt(2), sqrt(-4))
}
*/
/*
package main
import (
"fmt"
"math"
)
func pow(x, n, lim float64) float64 {
if v := math.Pow(x, n); v < lim {
return v
}
return lim
}
func main() {
fmt.Println(
pow(3, 2, 10),
pow(3, 3, 20),
)
}
*/
/*
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
// 起始数
z := float64(5)
// 起始数猜测,长度猜想
xLen := float64(len(string(int(x))))
if int(xLen)%2 > 0 {
xLen++
}
xLen = xLen * 0.5
// 起始数位数确认.
z *= math.Pow(10, xLen)
for i := 0; i < 10; i++ {
z = (z + x/z) * 0.5
}
return z
}
var arr = []float64{10, 16, 345, 668, 2992, 993, 443, 80, 726642, 469228, 1391791}
func main() {
fmt.Println(Sqrt(668))
fmt.Println(math.Sqrt(668))
for i := 0; i < len(arr); i++ {
fmt.Println(
"Number",
arr[i],
"Sqrt:",
Sqrt(arr[i]),
"mathSqrt:",
math.Sqrt(arr[i]),
)
}
}
*/
/*
package main
import (
"fmt"
"runtime"
)
func main() {
fmt.Print("Go 运行在 ")
switch os := runtime.GOOS; os {
case "darwin":
fmt.Println("OS X.")
case "linux":
fmt.Println("Linux.")
default:
fmt.Printf("%s.", os)
}
}
*/
/*
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println("什么时候才星期六?")
today := time.Now().Weekday()
switch time.Saturday {
case today + 0:
fmt.Println("今天.")
case today + 1:
fmt.Println("明天.")
case today + 2:
fmt.Println("后天.")
default:
fmt.Println("还远着呢!")
}
}
*/
/*
package main
import (
"fmt"
"time"
)
func main() {
t := time.Now()
switch {
case t.Hour() < 12:
fmt.Println("早上好!")
case t.Hour() < 17:
fmt.Println("下午好!")
default:
fmt.Println("晚上好!")
}
}
*/
/*
package main
import "fmt"
func main() {
defer fmt.Println("world")
fmt.Println("hello")
}
*/
package main
import "fmt"
func main() {
fmt.Println("counting")
for i := 0; i < 10; i++ {
defer fmt.Println(i)
}
fmt.Println("done")
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。