当前位置: 首页>>代码示例>>Golang>>正文


Golang pic.Show函数代码示例

本文整理汇总了Golang中golang.org/x/tour/pic.Show函数的典型用法代码示例。如果您正苦于以下问题:Golang Show函数的具体用法?Golang Show怎么用?Golang Show使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Show函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: main

func main() {
	fmt.Println("### Start Slice Exercise ###")

	pic.Show(Pic)

	fmt.Println("### End Slice Exercise ###")
}
开发者ID:tomoyan,项目名称:go_tour_exercise,代码行数:7,代码来源:exercise_slices.go

示例2: main

func main() {
	pointer()
	v := Vertex{1, 2}
	v.X = 4
	fmt.Println(v)

	p := &v
	p.X = 1e9
	fmt.Println(v)

	structLiterals()
	array()
	slice()
	tictactoe()
	slicing()

	makeslice()
	zeroSlice()
	appendSlice()
	ranges()

	pic.Show(Pic)

	var vLL = VertexLL{40.68433, -74.39967}
	geography("Bell Labs", vLL)
	fmt.Println(m["Bell Labs"])
	vLL = VertexLL{37.4828, 122.2361}
	geography("Redwood City", vLL)
	fmt.Println(m["Redwood City"])

	fmt.Println(m)

	mutateMap()
	wc.Test(WordCount)

	fmt.Println(hypot(5, 12))

	fmt.Println(compute(hypot))
	fmt.Println(compute(math.Pow))

	exAdder()

	f := fibonacci()
	for i := 0; i < 10; i++ {
		fmt.Println(f())
	}

}
开发者ID:happyspace,项目名称:gofun,代码行数:48,代码来源:pointer.go

示例3: main

func main() {
	pic.Show(Pic)
}
开发者ID:jbsturgeon,项目名称:tourOfGo,代码行数:3,代码来源:tourCh3Pic.go

示例4: TestExerciseSlices

func TestExerciseSlices(t *testing.T) {
	pic.Show(Pic)
}
开发者ID:matijavizintin,项目名称:tour-of-go,代码行数:3,代码来源:slices_test.go

示例5: main

func main() {
	i, j := 42, 2701

	// pointer to i
	p := &i

	fmt.Println(p, " -> ", *p)

	p = &j
	fmt.Println(p, " -> ", *p)
	*p = i
	fmt.Println(p, " -> ", *p)

	v1 := Vertex{4, 5}
	v2 := Vertex{X: 9, Y: 9}
	v3 := Vertex{X: 9} // Y=0 is implicit

	fmt.Println(v1.X)
	fmt.Println(v2, v3)

	// arrays
	var s1 [2]string

	s1[0] = "hi"
	s1[1] = "there"

	fmt.Println("a[0]: ", s1[0])
	fmt.Println("a: ", s1)

	arr := []int{1, 2, 4, 5, 23, 123, 5, 0}
	fmt.Println("arr ==", arr)

	for i := 0; i < len(arr); i++ {
		fmt.Printf("arr[%d] == %d\n", i, arr[i])
	}
	fmt.Println("arr[:3] == ", arr[:3])
	fmt.Println("arr[2:5] == ", arr[2:5])
	fmt.Println("arr[5:] == ", arr[5:])
	fmt.Println("arr[:] == ", arr[:])

	a := make([]int, 5)
	printSlice("a", a)
	b := make([]int, 0, 5)
	printSlice("b", b)
	c := b[:2]
	printSlice("c", c)
	d := c[2:5]
	printSlice("d", d)

	var z []int

	// zero value for empty array is nil
	if z == nil {

		fmt.Println("nil,", z)

	}

	printSlice("z", z)
	z = append(z, 1)
	z = append(z, 2)
	z = append(z, 4)
	var z2 []int = append(z, 3, 5, 6)
	printSlice("z", z)
	printSlice("z", z2)

	for i, v := range pow {
		fmt.Printf("2^%d = %d\n", i, v)
	}

	pwrs := make([]int, 10)
	for i := range pwrs {
		pwrs[i] = 1 << uint(i)
	}
	for _, val := range pwrs {
		fmt.Println(val)
	}
	pic.Show(Pic)

	var m map[string]Vertex

	m = make(map[string]Vertex)

	m["Bell labs"] = Vertex{342, 4532}

	var m2 = map[string]Vertex{
		"Google":           {33, 44},
		"General Electric": {54322, 3423},
		"deleteme":         {},
	}

	delete(m2, "deleteme")

	fmt.Println(m, m2)

	// functions

	hypnot := func(x, y float64) float64 {
		return math.Sqrt(x*x + y*y)
	}
//.........这里部分代码省略.........
开发者ID:lu-chi,项目名称:WebApplication,代码行数:101,代码来源:pointers.go

示例6: main

////Learning material used from
//https://tour.golang.org/moretypes/15
//GoTour needs to be installed locally
func main() {
	rand.Seed(time.Now().UTC().UnixNano())
	pic.Show(Pic)
}
开发者ID:Valkrysa,项目名称:FirstGo,代码行数:7,代码来源:DrawPicture.go

示例7: main

func main() {
	pic.Show(Pic)
	fmt.Println("hello, world")
}
开发者ID:bisco,项目名称:shakyo,代码行数:4,代码来源:exercise-slices.go

示例8: showPic

func showPic() {
	pic.Show(Pic)
}
开发者ID:paulweb515,项目名称:learning,代码行数:3,代码来源:hello.go

示例9: main


//.........这里部分代码省略.........
	fmt.Println(zNil, len(zNil), cap(zNil))
	if zNil == nil {
		fmt.Println("nil!")
	}

	var a2 []int
	printSlice("a2", a2)

	// append works on nil slices.
	a2 = append(a2, 0)
	printSlice("a2", a2)

	// the slice grows as needed.
	a2 = append(a2, 1)
	printSlice("a2", a2)

	// we can add more than one element at a time.
	a2 = append(a2, 2, 3, 4)
	printSlice("a2", a2)

	// range
	for i, v := range pow2 {
		fmt.Printf("2**%d = %d\n", i, v)
	}

	pow3 := make([]int, 10)
	for i := range pow3 {
		pow3[i] = 1 << uint(i)
	}
	for _, value := range pow3 {
		fmt.Printf("%d\n", value)
	}

	pic.Show(Pic)

	// Maps
	map1 = make(map[string]LocationCoordinate)
	map1["Bell Labs"] = LocationCoordinate{
		40.68433, -74.39967,
	}
	fmt.Println(map1["Bell Labs"])
	fmt.Println(map1)

	fmt.Println(map2)

	//Mutating Maps
	map3 := make(map[string]int)

	map3["Answer"] = 42
	fmt.Println("The value:", map3["Answer"])

	v6, ok1 := map3["Answer"]
	fmt.Println("The value:", v6, "Present?", ok1)

	map3["Answer"] = 48
	fmt.Println("The value:", map3["Answer"])

	delete(map3, "Answer")
	fmt.Println("The value:", map3["Answer"])

	v6, ok2 := map3["Answer"]
	fmt.Println("The value:", v6, "Present?", ok2)

	// map exercise
	wc.Test(WordCount)
开发者ID:trsathya,项目名称:go,代码行数:66,代码来源:sandbox.go

示例10: main

func main() {

	pic.Show(Pic) // base64
}
开发者ID:svr93,项目名称:go_examples,代码行数:4,代码来源:pic.go

示例11: main

func main() {
	pic.Show(Pic)
	pic.Show(PicRange)
}
开发者ID:iplog,项目名称:gotour,代码行数:4,代码来源:main.go

示例12: testPic

func testPic() {
	pic.Show(Pic)
}
开发者ID:fzh890523,项目名称:go_sth,代码行数:3,代码来源:exercise-making-slices.go

示例13: main

// 参考 https://tour.go-zh.org/moretypes/15
func main() {
	// nice choice (x+y)/2、x*y 和 x^y
	pic.Show(Pic)
}
开发者ID:Ryfthink,项目名称:go_learning,代码行数:5,代码来源:slice_exercise.go

示例14: ExecPic

func ExecPic() {
	pic.Show(Pic)
}
开发者ID:yu81,项目名称:go-sandbox,代码行数:3,代码来源:slice.go


注:本文中的golang.org/x/tour/pic.Show函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。