package main import("fmt") type Book struct{ Title string Description string Pages int } func main(){ var books []Book var title string var description string var pages int var kasSisestada string for{ fmt.Println("Kas sisestada (jah/ei)?") fmt.Scanln(&kasSisestada) if(kasSisestada=="ei"){break} fmt.Println("Pealkiri:") fmt.Scanln(&title) fmt.Println("Kirjeldus:") fmt.Scanln(&description) fmt.Println("Lehekülgi") fmt.Scanln(&pages) fmt.Println(title) var book1 Book book1.Title=title book1.Description=description book1.Pages=pages fmt.Println(book1.Title + " "+book1.Description) fmt.Println(book1.Pages) books=append(books, book1) } fmt.Println(books) printAllBooks(books) } func printAllBooks(books []Book){ for _, book:=range(books){ fmt.Printf("Pealkiri: %v, kirjeldus: %v, lehekülgi %v\n", book.Title, book.Description, book.Pages) } }