This is a simple console calculator which can calculate multiple expressions at once.
This project does not use any library related to data structures and algorithms. All data structures and algorithms are implemented from scratch.
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.
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
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.