fmt
This commit is contained in:
parent
27c33e1992
commit
5e7b7a2c01
20 changed files with 298 additions and 219 deletions
|
@ -4,18 +4,19 @@ pub fn main() {
|
|||
let mut input = String::new();
|
||||
std::io::stdin().read_line(&mut input).unwrap();
|
||||
match input.trim() {
|
||||
"1." | "1" | "mtokm" => read_and_convert(|u| {u * 1.609344}),
|
||||
"2." | "2" | "kmtom" => read_and_convert(|u| {u / 1.609344}),
|
||||
"1." | "1" | "mtokm" => read_and_convert(|u| u * 1.609344),
|
||||
"2." | "2" | "kmtom" => read_and_convert(|u| u / 1.609344),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn read_and_convert<F>(tom: F)
|
||||
where F: Fn(f64) -> f64
|
||||
where
|
||||
F: Fn(f64) -> f64,
|
||||
{
|
||||
println!("zadaj udaj");
|
||||
let mut input = String::new();
|
||||
std::io::stdin().read_line(&mut input).unwrap();
|
||||
let unit: f64 = input.trim().parse().unwrap();
|
||||
println!("{}", tom(unit));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue