diff options
Diffstat (limited to 'main.cc')
-rw-r--r-- | main.cc | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -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; +} |