This commit is contained in:
2026-05-02 13:54:36 +08:00
commit 1930967909
7 changed files with 208 additions and 0 deletions

31
src/bin/260202.rs Normal file
View File

@@ -0,0 +1,31 @@
use std::io;
use rand::prelude::*;
fn main() {
println!("[cioyu] 猜数游戏:");
let mut num = rand::rng();
let num = num.random_range(1..=100);
let mut index = 0;
while index<10 {
index += 1;
println!("请输入一个数字,当前还剩{}次机会",10-index);
let mut input = String::new();
io::stdin()
.read_line(&mut input)
.expect("读取输入发生了错误");
let input: i32 = match input.trim().parse() {
Ok(n) => n,
Err(_) => continue,
};
if input > num {
println!("你输入的数字大了")
} else if input < num {
println!("你输入的数字小了")
} else {
println!("你猜对了!!!");
break;
}
}
}

3
src/bin/260224.rs Normal file
View File

@@ -0,0 +1,3 @@
fn main() {
println!("群星闪耀 !!!")
}

13
src/bin/260328.rs Normal file
View File

@@ -0,0 +1,13 @@
enum Meju {
A,
B,
}
fn main() {
let s0: Meju = Meju::A;
let _s1: Meju = Meju::B;
match s0 {
Meju::A => {println!("s0的类型是 meju::a")},
Meju::B => {println!("s0的类型是 meju::b")}
}
}