-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Rust语言 | ||
- [rust语言支持中文变量吗](./rust语言支持中文变量吗.md) | ||
- [使用Rust编写Hello-World](./使用Rust编写Hello-World.md) | ||
- [Rust介绍](./rust介绍.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# rust语言支持中文变量吗 | ||
|
||
支持 | ||
|
||
示例代码如下 | ||
|
||
|
||
```rust | ||
use std::io; | ||
use rand::Rng; | ||
fn main() { | ||
println!("Guass the number!"); | ||
println!("请输入出猜测的数字: "); | ||
let mut guess = String::new(); | ||
let 密码 = rand::thread_rng().gen_range(1..=100); | ||
println!("密码是{}",密码); | ||
let count = io::stdin() | ||
.read_line(&mut guess) | ||
.expect("failed to read line"); | ||
println!("你输入的是: {}", guess); | ||
println!("你输入了{}个字符", count); | ||
let x = 5; | ||
let y = 10; | ||
println!("x = {x} and y + 2 = {}", y + 2); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters