Skip to content

ygor-rezende/Expression-Evaluator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Expression-Evaluator

Copyright: Garth Santor

Project Description

Visual C++ 2019/C++ 20 console application project that implements the Expression Evaluator that reads integers and real numbers, and outputs the result. This project implements the infix to postfix algorithm Shunting yard algorithm by Edsger Dijkstra, then implement a postfix to result algorithm Postfix algorithm and then evaluates the result.

Suported Types

It suports:

  • Real data type.

  • Mixed integer and real expressions.

  • Boolean data type along with its appropriate operators (AND, OR, NOT, XOR, NAND, NOR, XNOR) and real data types from the console and outputs the result.

  • Mathematical functions like arctan, max, min, abs, arccos, arcsin, ceil, cos, exp, floor, lb, ln, log, sin, sqrt, tan.

  • Variables

  • Stored Results - It stores the results of operations that can be used after just calling, for example, Result (# of result), eg. Result (1).

Design approach

There are several ways to implement this project such as:

  • The Big If
  • Polimorph on Operand
  • Polimorph on Operators
  • Double dispatch polimorphism
  • Lookup table

Each of these options has its pros and cons. This project used the Polymorph on Operator design type.

About

C++ Console Project: Expression Evaluator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages