From 83fd13866e39981baf6e31cecee802b6d7d1c7f3 Mon Sep 17 00:00:00 2001 From: Anders Nilsson <anders.nilsson@control.lth.se> Date: Sat, 7 Nov 2015 18:57:53 +0100 Subject: [PATCH] Added new game --- guessing_game/Cargo.lock | 4 ++++ guessing_game/Cargo.toml | 4 ++++ guessing_game/src/main.rs | 11 +++++++++++ 3 files changed, 19 insertions(+) create mode 100644 guessing_game/Cargo.lock create mode 100644 guessing_game/Cargo.toml create mode 100644 guessing_game/src/main.rs diff --git a/guessing_game/Cargo.lock b/guessing_game/Cargo.lock new file mode 100644 index 0000000..2b300da --- /dev/null +++ b/guessing_game/Cargo.lock @@ -0,0 +1,4 @@ +[root] +name = "guessing_game" +version = "0.1.0" + diff --git a/guessing_game/Cargo.toml b/guessing_game/Cargo.toml new file mode 100644 index 0000000..7d668d8 --- /dev/null +++ b/guessing_game/Cargo.toml @@ -0,0 +1,4 @@ +[package] +name = "guessing_game" +version = "0.1.0" +authors = ["Anders Nilsson <anders.nilsson@control.lth.se>"] diff --git a/guessing_game/src/main.rs b/guessing_game/src/main.rs new file mode 100644 index 0000000..0b88b48 --- /dev/null +++ b/guessing_game/src/main.rs @@ -0,0 +1,11 @@ +use std::io; + +fn main() { + println!("Guess the number!"); + println!("Please input your guess."); + + let mut guess = String::new(); + io::stdin().read_line(&mut guess).ok().expect("Failed to read line"); + + println!("You guessed: {}",guess); +} -- GitLab