mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 01:55:35 +08:00
update book code
This commit is contained in:
52
eBook/exercises/chapter_5/rectangle_stars.go
Normal file → Executable file
52
eBook/exercises/chapter_5/rectangle_stars.go
Normal file → Executable file
@@ -1,26 +1,26 @@
|
||||
// rectangle_stars.go
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
w, h := 20, 10
|
||||
for y := 0; y < h; y++ {
|
||||
for x := 0; x < w; x++ {
|
||||
fmt.Print("*")
|
||||
}
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
*/
|
||||
// rectangle_stars.go
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
w, h := 20, 10
|
||||
for y := 0; y < h; y++ {
|
||||
for x := 0; x < w; x++ {
|
||||
fmt.Print("*")
|
||||
}
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
/* Output:
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
********************
|
||||
*/
|
||||
|
Reference in New Issue
Block a user