Skip to content

rafaelrat/MathExpressionCalculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MathExpression Calculator

A CLI math expression calculator written in C

How it Works

In 1.1 version you can calculate math expressions, declare variables and use commands.

The calculator has 3 command modes, starting with an input expression.

  • Command Mode

    Execute commands like listvar, listcommands, clear, and more.

  • Variable Declaration Mode

    Declare variables with expressions like var_name=math expression

  • Math Expression Calculate

    Calculate math expressions like (124 / 4) * $pi

    The result is saved in $s special var

Supported operators

The operators supported are:

+ - * / ^

Only parentheses ( ) are supported.

Examples


>> (23 - 67)*(343)
-15092.00
>> $pi * 3
9.42
>> love=100
>> listvar
-------------------------------
|        Variables List       |
-------------------------------
love -> 100.00
$s -> 9.42
$pi -> 3.14
>> listcommands
-------------------------------
|        Commands List        |
-------------------------------
listcommands -> List the registered commands
listvar -> List the registered variables
clear -> Clear the CLI
exit -> Exit the program

How to install

Just clone this repository and run the build on ./bin/ according your OS.

If you want compile your own build run:

$ make && make run

or

$ gcc ./apps/MathCalculator ./src/* -I ./include -o ./bin/YourMathCalculatorBuild

About

A CLI math expression calculator written in C.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published