aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..2bc682a
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,23 @@
+#include <iostream>
+
+#include "parser.h"
+
+int main(int argc, char *argv[])
+{
+ string inputTerm;
+
+ std::cin >> inputTerm; // Example: 2.5*(2+3-(3/2+1))
+
+ Parser *parser = new Parser();
+
+ try {
+ std::cout << parser->calculate(inputTerm, false).result << std::endl;
+ }
+ catch ( exception &e )
+ {
+ std::cerr << e.what() << std::endl;
+ std::exit(1);
+ }
+
+ return 0;
+}