GithubHelp home page GithubHelp logo

c-calculator's Introduction

=======

C-Calculator

THIS IS THE README FILE FOR c++ CALCULATOR

The purpose of this was to learn and use OOP logic and work with memory allocation and deallocation.

This calculator takes input from the user, validates the expression (legal arithmetic expression, no exponents, no characters) and then it evaluates it using Expression Tree logic.


Valid Inputs

Includes the operands *, /, +, - Includes the rounded bracket symbols () but excludes all others [],{}

Excludes all other symbols and excludes all Letters/Characters

There cannot be double operands "*-" unless one is a bracket ")-" ,"+("

There cannot be spaces in between digits, "8 9" is incorrect input and not evaluated as 89.

There can be spaces in between operands and numbers; "1+ 99" is legal

Operand "#" is valid because it allows the program to exit (otherwise it is a continuous loop requiring inputs from the user)

Operand "@" is valid because it allows the user to re-evaluate the last expression but incrementing the numbers by 1. Note: -55 becomes -56 NOT -54. It solely increments the number and not the integer value


Class Files

There is a parent class Expression which consists mostly of virtual methods to be overridden. Inheriting from the parent class is the ArithmeticExpression class. This parses through and reassigns left and right side pointers to the left/right side and also reclasses them under their apropriate mathematic class (Multiplication, Division, Addition, Subtraction).


To Run

via CMD:

$ c++ MainClass.cpp -o MainClass.exe $ MainClass


Final Notes: There are some memory leakages evident in the program as it is.


This project was made with the collaboration of Rahul Bablani and Abeed Alibhai.

c-calculator's People

Contributors

natashadecoste avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.