Version bump

This commit is contained in:
William Davis 2024-01-05 20:14:43 -05:00
parent d88885423e
commit bae259b61c
No known key found for this signature in database
2 changed files with 9 additions and 5 deletions

View File

@ -1,4 +1,4 @@
[package] [package]
name = "ftoc" name = "ftoc"
version = "2.0.0" version = "2.0.1"
edition = "2021" edition = "2021"

View File

@ -28,16 +28,20 @@ fn main() {
.read_line(&mut input) .read_line(&mut input)
.expect("Failed to read line"); .expect("Failed to read line");
let input = input.trim(); let input = input.trim();
//Split the input into two strings, input: Contains the number /*
//and system: Contains if it is celcius or fahrenheit Split the input into two strings. Input, which contains the number;
and System, which contains if it is celcius or fahrenheit
*/
let (input,system) = input.split_at(input.len() - 1); let (input,system) = input.split_at(input.len() - 1);
//If the input in a number, output it, else, restart loop //If the input in a number, output it, else, restart loop
let input: f32 = match input.parse() { let input: f32 = match input.parse() {
Ok(num) => num, Ok(num) => num,
Err(_) => continue, Err(_) => continue,
}; };
//If the system is know, call the convert function, else, /*
//repeat loop If the system is known, call the convert function,
otherwise repeat loop
*/
match system { match system {
"C" => println!("{}°C is {:.2}°F", input, convert_to_f(input)), "C" => println!("{}°C is {:.2}°F", input, convert_to_f(input)),
"F" => println!("{}°F is {:.2}°C", input, convert_to_c(input)), "F" => println!("{}°F is {:.2}°C", input, convert_to_c(input)),