aboutsummaryrefslogtreecommitdiff
path: root/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'main.cc')
-rw-r--r--main.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/main.cc b/main.cc
new file mode 100644
index 0000000..c03cce2
--- /dev/null
+++ b/main.cc
@@ -0,0 +1,27 @@
+#include <iostream>
+#include <limits>
+
+#include "src/parser.h"
+
+int main()
+{
+ std::string inputTerm;
+
+ std::cin >> inputTerm; // Example: 2.5*(2+3-(3/2+1))
+
+ SimpleParser::Parser parser;
+
+ try {
+ typedef std::numeric_limits<double> dbl;
+ std::cout.precision(dbl::digits10);
+
+ std::cout << parser.calculate(inputTerm) << std::endl;
+ }
+ catch ( std::exception &e )
+ {
+ std::cerr << e.what() << std::endl;
+ return 1;
+ }
+
+ return 0;
+}