Open codemaster1104 opened 1 month ago
flows summarize
Hello, I am a PR summary bot on flows.network.
It could take a few minutes for me to analyze this PR. Relax, grab a cup of coffee and check back later. Thanks!
flows summarize
Hello, I am a PR summary bot on flows.network.
It could take a few minutes for me to analyze this PR. Relax, grab a cup of coffee and check back later. Thanks!
use std::io::{self, Write};
enum Operation { Add, Subtract, Multiply, Divide, }
impl Operation { fn fromstr(input: &str) -> Option {
match input {
"+" => Some(Operation::Add),
"-" => Some(Operation::Subtract),
"*" => Some(Operation::Multiply),
"/" => Some(Operation::Divide),
=> None,
}
}
}
fn main() { loop { println!("Enter first number:"); let mut num1 = String::new(); io::stdin().readline(&mut num1).expect("Failed to read line"); let num1: f64 = match num1.trim().parse() { Ok(n) => n, Err() => { println!("Please enter a valid number"); continue; }, };
}