new go file go/l4.go for request your name and age, print output of this data
This commit is contained in:
parent
2f5ea78196
commit
d546fd4bec
2 changed files with 49 additions and 0 deletions
49
go/l4.go
Normal file
49
go/l4.go
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func logic() string {
|
||||||
|
fmt.Println("Твой возраст")
|
||||||
|
var x int
|
||||||
|
_, err := fmt.Scan(&x)
|
||||||
|
if err != nil {
|
||||||
|
return "еблан"
|
||||||
|
}
|
||||||
|
var phrase string
|
||||||
|
switch {
|
||||||
|
case x < 0:
|
||||||
|
phrase = "Ты еще не родился"
|
||||||
|
case x < 12:
|
||||||
|
phrase = "Малолетка ебаная"
|
||||||
|
case x >= 12 && x <= 19:
|
||||||
|
phrase = "Ты подросток"
|
||||||
|
case x >= 20 && x <= 65:
|
||||||
|
phrase = "Ебать ты средний"
|
||||||
|
case x > 65:
|
||||||
|
phrase = "Все давай в могилу"
|
||||||
|
default:
|
||||||
|
phrase = "не"
|
||||||
|
}
|
||||||
|
return phrase
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Println("Как звать тебя")
|
||||||
|
var name string
|
||||||
|
fmt.Scanln(&name)
|
||||||
|
for {
|
||||||
|
fmt.Println("1. Начать\n2. Закончить")
|
||||||
|
var pol string
|
||||||
|
fmt.Scanln(&pol)
|
||||||
|
if pol == "1" {
|
||||||
|
phr := logic()
|
||||||
|
fmt.Println("Тебя зовут", name, ",", phr)
|
||||||
|
} else if pol == "2" {
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
fmt.Println("Не то")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
go/output/l4
Executable file
BIN
go/output/l4
Executable file
Binary file not shown.
Loading…
Reference in a new issue