Rust Calculator

A simple command-line calculator written in Rust.

Description

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.

Features

  • Addition (+)
  • Subtraction (-)
  • Multiplication (*)
  • Division (/)

Getting Started

Prerequisites

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.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/rust-calculator.git
  2. Change into the project directory:

    cd rust-calculator
  3. Build the project:

    cargo build

Usage

  1. Run the program:

    cargo run
  2. Follow the on-screen instructions to enter the operation symbol, first number, and second number.

  3. The program will display the result of the calculation.

Example

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.