diff options
author | Adrian Kummerländer | 2013-01-05 22:30:35 +0100 |
---|---|---|
committer | Adrian Kummerländer | 2013-01-05 22:30:35 +0100 |
commit | cde848ce1eb995170723f6f070b9fcba0dfdb880 (patch) | |
tree | b28b436619ade0f9b3ff7603cc987d7b5a621ff3 /main.cc | |
parent | e3081360c65eb4994e7e8042898cec72de0d560b (diff) | |
download | SimpleParser-cde848ce1eb995170723f6f070b9fcba0dfdb880.tar SimpleParser-cde848ce1eb995170723f6f070b9fcba0dfdb880.tar.gz SimpleParser-cde848ce1eb995170723f6f070b9fcba0dfdb880.tar.bz2 SimpleParser-cde848ce1eb995170723f6f070b9fcba0dfdb880.tar.lz SimpleParser-cde848ce1eb995170723f6f070b9fcba0dfdb880.tar.xz SimpleParser-cde848ce1eb995170723f6f070b9fcba0dfdb880.tar.zst SimpleParser-cde848ce1eb995170723f6f070b9fcba0dfdb880.zip |
Moved node classes into separate compilation unit; File extension change
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; +} |