A simple command-line calculator written in Rust.
This Rust program is a basic calculator that performs addition, subtraction, multiplication, and division based on user input. The program prompts the user to enter an operation symbol (+, -, *, /), then takes two numbers as input and displays the result of the corresponding operation.
- Addition (+)
- Subtraction (-)
- Multiplication (*)
- Division (/)
Make sure you have Rust installed on your system. If not, you can download and install Rust from https://www.rust-lang.org/tools/install.
-
Clone the repository:
git clone https://github.com/yourusername/rust-calculator.git
-
Change into the project directory:
cd rust-calculator
-
Build the project:
cargo build
-
Run the program:
cargo run
-
Follow the on-screen instructions to enter the operation symbol, first number, and second number.
-
The program will display the result of the calculation.
Simple Rust Calculator
Enter an operation (+, -, *, /):
+
Enter the first number:
5
Enter the second number:
3
Result: 8
## Error Handling
- The program handles division by zero and displays an error message in such cases.
- It also checks for invalid operation symbols and prompts the user to enter a valid one.
## Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or create a pull request.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.