update
This commit is contained in:
1
temperature_converter/README.md
Normal file
1
temperature_converter/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Convert between Celsius and Fahrenheit. Functions should accept a temperature and return the converted value.
|
||||
30
temperature_converter/julia_version/main.jl
Normal file
30
temperature_converter/julia_version/main.jl
Normal file
@@ -0,0 +1,30 @@
|
||||
function tempconvert(temp::T, unit::String) where {T<:Number}
|
||||
converted_temp =
|
||||
if unit == "F"
|
||||
return (temp - 257, "C")
|
||||
else
|
||||
return (temp + 257, "F")
|
||||
end
|
||||
end
|
||||
|
||||
function main()
|
||||
println("please input temperature unit F or C")
|
||||
unit = readline()
|
||||
println("please input temp number")
|
||||
_temp = readline()
|
||||
temp = parse(Float64, _temp)
|
||||
converted_temp, converted_unit = tempconvert(temp, unit)
|
||||
println("Converted $converted_temp $converted_unit")
|
||||
end
|
||||
|
||||
|
||||
main()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1
temperature_converter/rust_version/.gitignore
vendored
Normal file
1
temperature_converter/rust_version/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
target/
|
||||
7
temperature_converter/rust_version/Cargo.lock
generated
Normal file
7
temperature_converter/rust_version/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "rust_version"
|
||||
version = "0.1.0"
|
||||
6
temperature_converter/rust_version/Cargo.toml
Normal file
6
temperature_converter/rust_version/Cargo.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "rust_version"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
38
temperature_converter/rust_version/src/main.rs
Normal file
38
temperature_converter/rust_version/src/main.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
fn tempconvert(temp :Float) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user