Rust学习-接收键盘输入并打印(二)

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);
}

猜你喜欢

转载自boyseegirl.iteye.com/blog/2294959