physik_test/main.rs
robin c74e306403 main.rs hinzugefügt
Batman! (this commit has no parents)
2024-05-09 12:55:35 +02:00

27 lines
733 B
Rust

use rand::Rng;
fn main() {
let mut number:i128 = 0;
loop {
let rng:i128 = rand::thread_rng().gen_range(1..=1000000000000000000000000);
println!("Do you want to add {} to the number", rng);
println!("Your number is {}(y/n)", number);
let mut input: String = String::new();
std::io::stdin().read_line(&mut input).expect("Failed to read line");
let input: String = input.trim().parse().unwrap();
let yes:String = String::from("y");
let no = String::from("no");
if input == yes {
let number = number+=rng;
}
else if input == no {
}
else {
println!("Invalid input");
}
}
}