Skip to content

A very basic math expressions(infix) evaluator

License

Notifications You must be signed in to change notification settings

b37t1td/libcalc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libcalc

A very basic math expressions(infix) evaluator

Build Status

This library built using basic RPN algorithm and intended to evaluate infix math expressions. In simple words it evaluates expressions like this:

( 5 - 3 ) * 2

into

4

Installation

  git clone [email protected]:b37t1td/libcalc.git
  cd libcalc
  take build
  cmake ..
  cpack
  sudo dpkg -i libcalc_*.deb

Usage

Example of test.cxx

#include <iostream>
#include <libcalc.hpp>

int main() {
  std::cout << libcalc::eval("2 * ( 5 - 3 )") << std::endl;
}

Which we build with:

g++ -std=c++11 -Wall test.cxx `pkg-config --libs --cflags libcalc`

So, run it ./a.out and you will see 4.

License

MIT

About

A very basic math expressions(infix) evaluator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published