2 files changed, 5 insertions(+), 5 deletions(-)
@@ -1,3 +1,3 @@
This is a learning exercise that I did while learning Rust.
CLI program that simply allows conversions between temperatures in Farenheit and Celsius.
CLI program that simply allows conversions between temperatures in Fahrenheit and Celsius.
@@ -27,9 +27,9 @@
let start_temp = read_temp();
if direction == "1" {
println!("{start_temp}F is equal to {}C",farenheit_to_celsius(start_temp));
println!("{start_temp}F is equal to {}C",fahrenheit_to_celsius(start_temp));
} else {
println!("{start_temp}C is equal to {}F", celsius_to_farenheit(start_temp));
println!("{start_temp}C is equal to {}F", celsius_to_fahrenheit(start_temp));
}
}
}
@@ -44,10 +44,10 @@
parsed_temp
}
fn farenheit_to_celsius(temp_to_convert: f64) -> f64 {
fn fahrenheit_to_celsius(temp_to_convert: f64) -> f64 {
(temp_to_convert - 32.0) / 1.8
}
fn celsius_to_farenheit(temp_to_convert: f64) -> f64 {
fn celsius_to_fahrenheit(temp_to_convert: f64) -> f64 {
(temp_to_convert * 1.8) + 32.0
}