我复制粘贴,从代码锈病编程语言下的标题“处理的猜测”到锈游乐场。但是,标准输出中没有显示提示。我已经搜索了这个问题,我认为这可能是帮助列出的“局限性”之一。
我已经决定应该使用一些可以在没有Playground的情况下进行编码的软件,但是我还没有设置IDE,所以这也不是我的问题的一部分。
我试图做的是将以下代码复制粘贴到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);
}
Run Code Online (Sandbox Code Playgroud)
结果是它将正确编译,而不会出现任何紧急攻击,错误或警告,并输出以下内容到“标准输出”:
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);
}
Run Code Online (Sandbox Code Playgroud)
本书清单2-1中的信息告诉我们,此代码应能够从用户和猜测的打印内容中得到猜测(作为字符串)。
我的期望是,我将能够单击“标准输出”中的行,其中显示:
Guess the number!
Please input your guess.
You guessed:
Run Code Online (Sandbox Code Playgroud)
但是,当我单击冒号右侧的空白并开始输入时,没有新的字符串出现。 …
rust ×1