{
loop {
println!("Input the temperature in Celsius:");
let mut celsius = String::new();
io::stdin().read_line(&mut celsius)
.expect("Failed to read the string");
println!("You've entered {}", celsius);
match celsius.trim().parse() {
Ok(num: i32) => {
let fh: i32 = num * 9/5 + 32;
println!("fh: {}", fh);
break
},
Err(_) => continue,
};
}
}
.parse::<i32>()
Обсуждают сегодня