This commit is contained in:
2026-03-31 08:06:49 +07:00
parent e611e0222f
commit b1cbc67664
5 changed files with 73 additions and 2 deletions

View File

@@ -83,6 +83,22 @@ fn main() {

View File

@@ -1,4 +1,40 @@
/* --------------------------------------------- 100 -------------------------------------------- */
use rand::prelude;
use std::prelude;
use rand::{Rng, thread_rng};
use std::io::{self, stdin};
fn main () {
let mut myrng = thread_rng();
let secret_number = myrng.gen_range(1..100);
loop {
let mut user_guess = String::new();
let std_in = stdin();
match std_in.read_line(&mut user_guess) {
Ok(_) => {
// The underscore _ means we don't care about the byte count
// We just care that it succeeded.
println!("You guessed: {}", user_guess);
},
Err(error) => {
// Here we handle the error manually
println!("Problem reading input: {}", error);
}
}
println!("please input you guess number");
}
}