From dacf5eec1e33218deb62414a3a3f488c11d07138 Mon Sep 17 00:00:00 2001 From: mollusk Date: Tue, 8 Aug 2017 17:12:52 -0700 Subject: [PATCH] Fixed incorrect ignore file --- .gitignore | 1 - guess_number/.gitignore | 1 + guess_number/guess_number.go | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 guess_number/.gitignore create mode 100644 guess_number/guess_number.go diff --git a/.gitignore b/.gitignore index c8ac328..a803526 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ golearn -guess_number \ No newline at end of file diff --git a/guess_number/.gitignore b/guess_number/.gitignore new file mode 100644 index 0000000..1d855af --- /dev/null +++ b/guess_number/.gitignore @@ -0,0 +1 @@ +guess_number \ No newline at end of file diff --git a/guess_number/guess_number.go b/guess_number/guess_number.go new file mode 100644 index 0000000..3251f91 --- /dev/null +++ b/guess_number/guess_number.go @@ -0,0 +1,35 @@ +package main + +import ("fmt" + "math/rand" + "time" + ) + +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") + } + } + +} \ No newline at end of file