Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,16 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
gc "code.google.com/p/goncurses"
|
||||
)
|
||||
|
||||
func main() {
|
||||
_, err := gc.Init()
|
||||
if err != nil {
|
||||
log.Fatal("init:", err)
|
||||
}
|
||||
defer gc.End()
|
||||
gc.FlushInput()
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
stdin := bufio.NewReader(os.Stdin)
|
||||
|
||||
fmt.Println("Please enter an integer: ")
|
||||
|
||||
var i1 int
|
||||
|
||||
for {
|
||||
_, err := fmt.Fscan(stdin, &i1)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
stdin.ReadString('\n')
|
||||
fmt.Println("Sorry, invalid input. Please enter an integer: ")
|
||||
flush(stdin)
|
||||
}
|
||||
|
||||
fmt.Println(i1)
|
||||
}
|
||||
|
||||
func flush(reader *bufio.Reader) {
|
||||
var i2 int
|
||||
for i2 = 0; i2 < reader.Buffered(); i2++ {
|
||||
reader.ReadByte()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue