Read user input with io::stdin().read_line() and display results using println!() in Rust.
Use std::io to read from standard input and println! to write to standard output.
use std::io;
fn main() {
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}");
}
Standard input is how your program reads data typed by a user, while standard output is how it displays results on the screen. Think of stdin as the program's ears and stdout as its mouth. You use these tools to create interactive applications that respond to user commands.