commit c74e306403df968d31e2d771ed301a4bdafe4720 Author: robin Date: Thu May 9 12:55:35 2024 +0200 main.rs hinzugefĆ¼gt Batman! (this commit has no parents) diff --git a/main.rs b/main.rs new file mode 100644 index 0000000..ccd6eed --- /dev/null +++ b/main.rs @@ -0,0 +1,26 @@ +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"); + } + + } + +}