Bookmark - ch2
This commit is contained in:
parent
ae5b610260
commit
c56962282e
3 changed files with 24 additions and 1 deletions
8
02-guessing_game/Cargo.toml
Normal file
8
02-guessing_game/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "guessing_game"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
15
02-guessing_game/src/main.rs
Normal file
15
02-guessing_game/src/main.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
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}");
|
||||||
|
}
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
Me learning Rust.
|
Me learning Rust.
|
||||||
|
|
||||||
[Interactive Book](https://rust-book.cs.brown.edu/)
|
[Interactive Book(mark)](https://rust-book.cs.brown.edu/ch02-00-guessing-game-tutorial.html)
|
Loading…
Reference in a new issue