index : temp_converter
Convert temperature degres
about summary refs log tree commit diff

Diffstat

-rw-r--r-- README.md 2
-rw-r--r-- src/main.rs 8
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 7a6570c..22c457f 100644
--- a/README.md
+++ b/README.md
@@ -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.
diff --git a/src/main.rs b/src/main.rs
index fdb0558..0dcf3c6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -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
}