Create a guessing game
This commit is contained in:
parent
2cba306b8d
commit
fa7d9e460f
3 changed files with 27 additions and 0 deletions
7
guessing_game/Cargo.lock
generated
Normal file
7
guessing_game/Cargo.lock
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "guessing_game"
|
||||
version = "0.1.0"
|
6
guessing_game/Cargo.toml
Normal file
6
guessing_game/Cargo.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "guessing_game"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
14
guessing_game/src/main.rs
Normal file
14
guessing_game/src/main.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
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)
|
||||
.expect("Failed to read line");
|
||||
|
||||
println!("You guessed: {}", guess);
|
||||
}
|
Loading…
Reference in a new issue