Version bump
This commit is contained in:
parent
d88885423e
commit
bae259b61c
|
@ -1,4 +1,4 @@
|
|||
[package]
|
||||
name = "ftoc"
|
||||
version = "2.0.0"
|
||||
version = "2.0.1"
|
||||
edition = "2021"
|
||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -28,16 +28,20 @@ fn main() {
|
|||
.read_line(&mut input)
|
||||
.expect("Failed to read line");
|
||||
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);
|
||||
//If the input in a number, output it, else, restart loop
|
||||
let input: f32 = match input.parse() {
|
||||
Ok(num) => num,
|
||||
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 {
|
||||
"C" => println!("{}°C is {:.2}°F", input, convert_to_f(input)),
|
||||
"F" => println!("{}°F is {:.2}°C", input, convert_to_c(input)),
|
||||
|
|
Loading…
Reference in New Issue