结构体-练习答案

2018-06-18  本文已影响0人  tonyemail_st

结构体练习

package main

import (
    "fmt"
)

type book struct {
    title string
    author string
    press string
    price float32
}


func main(){
    fmt.Println(book{"Python高级编程", "姚军(译)", "人民邮电出版社", 45.00})
    b := book{"云计算实践教程", "金永霞", "电子工业出版社", 42.00}
    fmt.Printf("%s %f\n", b.title, b.price)
    c := book{"零基础学Python", "张志强", "机械工业出版社", 79.00}
    fmt.Printf("%s %f\n", c.title, c.price)
}

上一篇下一篇

猜你喜欢

热点阅读