A simple command-line application written in Rust to convert temperatures between Celsius and Fahrenheit. This beginner-friendly project demonstrates basic input/output operations and temperature conversion formulas.
- Celsius to Fahrenheit: Converts a temperature value from Celsius to Fahrenheit.
- Fahrenheit to Celsius: Converts a temperature value from Fahrenheit to Celsius.
- Quit Option: Allows the user to exit the program gracefully.
- Rust (version 1.65.0 or later)
- Clone the repository:
git clone https://github.com/Cod-e-Codes/rust-temp-converter.git cd rust-temp-converter
- Build the project:
cargo build --release
- Run the project:
cargo run
When you run the application, you will be presented with a menu:
Temperature Converter
Choose an option:
1. Celsius to Fahrenheit
2. Fahrenheit to Celsius
3. Quit
- Select
1
from the menu. - Enter the temperature in Celsius.
- The program will display the equivalent temperature in Fahrenheit.
- Select
2
from the menu. - Enter the temperature in Fahrenheit.
- The program will display the equivalent temperature in Celsius.
- Select
3
from the menu to exit the application.
Temperature Converter
Choose an option:
1. Celsius to Fahrenheit
2. Fahrenheit to Celsius
3. Quit
Choose an option: 1
Enter temperature in Celsius: 25
25°C is equal to 77.00°F
Choose an option: 2
Enter temperature in Fahrenheit: 77
77°F is equal to 25.00°C
Choose an option: 3
Exiting...
main.rs
: The main program logic.
- Conversion Formulas:
- Celsius to Fahrenheit:
(C × 9/5) + 32
- Fahrenheit to Celsius:
(F - 32) × 5/9
- Celsius to Fahrenheit:
- Error Handling:
- Handles invalid input and prompts the user to enter a valid number.
This project is licensed under the MIT License. See the LICENSE
file for details.
Contributions are welcome! Feel free to open an issue or submit a pull request.