40 lines
572 B
Go
40 lines
572 B
Go
|
package main
|
||
|
|
||
|
import ("fmt"
|
||
|
"math/rand"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func input(var Text string){
|
||
|
fmt.Printf(text)
|
||
|
fmt.Scan(&text)
|
||
|
return Text
|
||
|
}
|
||
|
func main(){
|
||
|
rand.Seed(time.Now().UnixNano())
|
||
|
var randNumber int = rand.Int()%100
|
||
|
|
||
|
stuff := true
|
||
|
|
||
|
for stuff == true{
|
||
|
|
||
|
fmt.Print("Guess a number between 1 and 100: ")
|
||
|
var guess int
|
||
|
fmt.Scan(&guess)
|
||
|
|
||
|
if guess > randNumber{
|
||
|
fmt.Println("Too High")
|
||
|
|
||
|
}else if guess < randNumber{
|
||
|
fmt.Print("Too low" + "\n")
|
||
|
|
||
|
|
||
|
}else if guess == randNumber{
|
||
|
fmt.Println("Correct")
|
||
|
|
||
|
}else{
|
||
|
fmt.Println("What the fuck")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|