-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
/*
file_name :main.rs
author : a.e.
comment : Line of codes myteriously gone I didn't know how did that
happened "io::stdout().flush();". It just puzzled I couldn't
` figure it out, what the hell is wrong with RUST?
*/
extern crate rand;
use std::io;
use std::io::Write;
use rand::Rng;
use std::cmp::Ordering;
fn main()
{
println!("Guess the number between 1-2048, You have 10 chances to guess it:");
println!("Please enter your guess:");
let secret_number = rand::thread_rng().gen_range(1,2048);
let mut lifecount = 11;
loop{
let mut guess = String::new();
lifecount -= 1;
println!("LIFE:{}",lifecount);
if lifecount == 0 {
println!("GAME OVER, BRO! The secret number is {}",secret_number);
break;
}
print!("Your guess:{}",guess);
let _= io::stdout().flush();
io::stdin().read_line(&mut guess).expect("Failed to read line");
let guess: u32 = match guess.trim().parse(){
Ok(num) => num,
Err(_) => continue,
};
match guess.cmp(&secret_number){
Ordering::Less => println!("It's LOW"),
Ordering::Greater => println!("It's HIGH"),
Ordering::Equal => { println!("You are right! the secret number is {}",secret_number); break; }
}
// println!("The secret number is {}", secret_number);
}
}
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCAAdFiEEMaSGVbW1csUNPjn0VYFrPBLDrx0FAmhu3OkACgkQVYFrPBLD
rx1tlQv/YLE2tYc8Psa/lgg1CliRx3tllimInZCETSjrKCHaJI0QlrUW67LwovGT
eB5T4IeW0fbgVSKGRSB8bITz+xnyISW4NQrmMSDBn6i/M8RTkcENCP1jMmRRTvWU
6jdw9pnVOW+3wnPMtseBVhOAFTYeq1OEJAHkdFHKvB4pIWxcit13oZO1BVprWE/9
4qBhzJI4FitnDjHLX8fi0/jkSpCHQqIJ8wpWO70kTKjqNeJJIhJRsHCxPVkfWjTW
REAqAi+OOsfFXYBonoEDCxVlPLTAufnHnEuhuLCT5qZouPKiezIVQva3cdgV8C9Z
vMZr7AA8ZOSGiHwtAXJH7VFpNgmRS5NEeg+gtPZzsrd+2JheJWhPPQbf99dCvi30
xQ5S22lWRgEQI+qaD45ysrDY+FvMem8tEAWN29c57QPFOWI0Z1Rzv0YeP3I42hmt
1AmQ6lghJQU15CF3kR1PMwsJ21ccfOtVFiCgaTW04YF1E/1fVyIGIRzsXXg6W3UL
zoNC2I3P
=sKEZ
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 06-19-2025 It has been 8 months since Tatay's passing, and yet it is still painful, ...
-
Ted just graduate in high school in 1959in Grinhar or Los BaƱos High School He was the one of they called Honor roll because our education s...
-
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 06-19-2025 It has been 8 months since Tatay's passing, and yet it is still painful, ...
-
I have this link I occasionally get updated: https://raw.githubusercontent.com/telnet15/linux-unix-cheatsheet-tutorial/refs/heads/2ndmain/My...