Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
13
Task/User-input-Text/Go/user-input-text-1.go
Normal file
13
Task/User-input-Text/Go/user-input-text-1.go
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
var s string
|
||||
var i int
|
||||
if _, err := fmt.Scan(&s, &i); err == nil && i == 75000 {
|
||||
fmt.Println("good")
|
||||
} else {
|
||||
fmt.Println("wrong")
|
||||
}
|
||||
}
|
||||
38
Task/User-input-Text/Go/user-input-text-2.go
Normal file
38
Task/User-input-Text/Go/user-input-text-2.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
in := bufio.NewReader(os.Stdin)
|
||||
|
||||
fmt.Print("Enter string: ")
|
||||
s, err := in.ReadString('\n')
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
s = strings.TrimSpace(s)
|
||||
|
||||
fmt.Print("Enter 75000: ")
|
||||
s, err = in.ReadString('\n')
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
n, err := strconv.Atoi(strings.TrimSpace(s))
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
if n != 75000 {
|
||||
fmt.Println("fail: not 75000")
|
||||
return
|
||||
}
|
||||
fmt.Println("Good")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue