use std::io::{self, Write}; use day22::area_to_fields; fn main() { let mut buffer = String::new(); print!("Insert the deforested area in km2: "); io::stdout().flush().expect("Failed to flush stdout"); io::stdin() .read_line(&mut buffer) .expect("Failed to read line"); let area = buffer.trim().parse().expect("The area must be an integer"); let fields = area_to_fields(area); println!( "{} km2 is equivalent to {:.3} football fields", area, fields ); }