Coder Social home page Coder Social logo

funcalc's Introduction

Calculator Program

Introduction

This is a simple console calculator which can calculate multiple expressions at once.

Implementation

This project does not use any library related to data structures and algorithms. All data structures and algorithms are implemented from scratch.

Build

This project can be built using CMake and the CMakeLists.txt file. Otherwise, any IDE would be sufficient.

Note: This project was built with the C++14 flag. Enable this flag to avoid compiling errors.

Usage

The program supports two different modes: input directly in the console, or input with a text file. Both relative or absolute path can be used for the file mode.

Each line must have the following syntax:

<variable> = <expression>

Supported operators:

  • +, -, *, /, ^
  • div, mod (integers only)
  • functions: sin, cos, tan, cot, exp

pi constant is also supported.

Example:

  • Input file:
a = 2 + 3 + (3)
b = a + 4
c = 3 * b - 3^2
d = c mod 4
e = 10 - 3 * 4
f = 100 - (2 + 3 * 4)
g = (1 + (10 * (3 - 2)))
h = sin(0.5)
i = exp(exp(0.5))
k = pi
x = 2
y = 3
z = x^2 + y^3
  • Output:
Evaluation Result:
[a] = 8.000000
[b] = 12.000000
[c] = 27.000000
[d] = 3.000000
[e] = -2.000000
[f] = 86.000000
[g] = 11.000000
[h] = 0.479426
[i] = 5.200326
[k] = 3.141593
[x] = 2.000000
[y] = 3.000000
[z] = 31.000000

funcalc's People

Contributors

ocykat avatar

Stargazers

Chelsa MJ avatar Trong Nhan Mai 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.