Convert temperatures between Fahrenheit, Celsius, and Kelvin.
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
I'm learning Rust by working through "The Book" and building simple projects to practice the concepts discussed in various chapters. This is one of those projects.
You made it! This was a sizable chapter: you learned about variables, scalar and compound data types, functions, comments, if expressions, and loops! To practice with the concepts discussed in this chapter, try building programs to do the following:
- Convert temperatures between Fahrenheit and Celsius.
- Generate the nth Fibonacci number.
- Print the lyrics to the Christmas carol “The Twelve Days of Christmas,” taking advantage of the repetition in the song.
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
Rust
- Linux/macOS
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh
- Windows
https://www.rust-lang.org/tools/install
[Optional] Install a C compiler
- Linux
sudo apt install build-essential
- macOS
xcode-select --install
- Windows
https://visualstudio.microsoft.com/downloads/
- Clone the repo
git clone https://github.com/jasoncavinder/convert_temp.git
Build & Run
cargo run
Convert temperatures between Fahrenheit, Celsius, and Kelvin.
Enter a temperature and a unit (F, C, or K) to convert to the other units.
98.6F
98.6 °Fahrenheit is 37.0 °Celsius and 310.15 Kelvin.
Enter another temperature to convert or press enter to exit.
Enter a temperature and a unit (F, C, or K) to convert to the other units.
55C
55.0 °Celsius is 131.0 °Fahrenheit and 328.15 Kelvin.
Enter another temperature to convert or press enter to exit.
Enter a temperature and a unit (F, C, or K) to convert to the other units.
100K
100.0 Kelvin is -173.15 °Celsius and -279.67 °Fahrenheit.
Enter another temperature to convert or press enter to exit.
Enter a temperature and a unit (F, C, or K) to convert to the other units.
-500F
Temperature is below absolute zero.
Enter a temperature and a unit (F, C, or K) to convert to the other units.
0k
0.0 Kelvin is -273.15 °Celsius and -459.67 °Fahrenheit.
Enter another temperature to convert or press enter to exit.
Enter a temperature and a unit (F, C, or K) to convert to the other units.
-10C
-10.0 °Celsius is 14.0 °Fahrenheit and 263.15 Kelvin.
Enter another temperature to convert or press enter to exit.
Enter a temperature and a unit (F, C, or K) to convert to the other units.
Exiting.
- Add comments and documentation
- Optimize code
See the open issues for a full list of proposed features (and known issues).
Distributed under the Unlicense. See UNLICENSE.md
for more information.
(book) The Rust Programming Language
Jason Cavinder - @jasoncavinder - [email protected] - Jason Cavinder
Project Link: https://github.com/jasoncavinder/convert_temp