Create a guessing game

This commit is contained in:
Manuel Thalmann 2024-10-11 23:07:22 +02:00
parent 2cba306b8d
commit fa7d9e460f
3 changed files with 27 additions and 0 deletions

7
guessing_game/Cargo.lock generated Normal file
View 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
View file

@ -0,0 +1,6 @@
[package]
name = "guessing_game"
version = "0.1.0"
edition = "2021"
[dependencies]

14
guessing_game/src/main.rs Normal file
View 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);
}