Skip to content

CoininDev/calculadore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calculadore

Calculadore is a calculator written in Rust, developed for learning purposes. It uses Reverse Polish Notation to perform calculations respecting the order of operations and priorities.

Functionalities

  • Operations Already Supported: Addition (+), Subtraction (-), Multiplication (*), Division (/) and Exponentiation (^).
  • Parentheses: Support for the use of parentheses to define the order of operations.

How to Use

  1. Clone the Repository:

    git clone https://github.com/CoininDev/calculadore.git
    cd calculadore
  2. Compile the Project:

    cargo build

    NOTE: You need to install Rust to compile the project.

  3. Run the Calculator:

    cargo run
  4. Enter a Mathematical Expression:

    • Examples: 2+3*4, (1+2)^3
    • To exit, type exit.

Code Structure

  • Tokenization: The tokenize function converts a string of mathematical expression into a list of tokens.
  • Shunting Yard: The shunting_yard function converts the list of tokens to reverse polish notation (RPN).
  • Evaluation: The evaluate function calculates the value of the expression in RPN.

Contribution

Contributions are welcome! Feel free to open issues and pull requests.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages