From 041a56a919ae49db46fa34adc8de90f0feb69bb0 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Sat, 19 Oct 2013 14:47:53 +0200 Subject: Added simple input loop to clc --- clc.cc | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/clc.cc b/clc.cc index 3378e14..5eb0d9e 100644 --- a/clc.cc +++ b/clc.cc @@ -3,22 +3,19 @@ #include "src/parser.h" -int main() -{ +typedef std::numeric_limits dbl; + +int main() { std::string inputTerm; + std::cout.precision(dbl::digits10); - std::cin >> inputTerm; - - try { - typedef std::numeric_limits dbl; - std::cout.precision(dbl::digits10); - - std::cout << SimpleParser::calculate(inputTerm) << std::endl; - } - catch ( std::exception &e ) - { - std::cerr << e.what() << std::endl; - return 1; + while ( std::cin >> inputTerm ) { + try { + std::cout << SimpleParser::calculate(inputTerm) << std::endl; + } + catch ( std::exception &e ) { + std::cerr << e.what() << std::endl; + } } return 0; -- cgit v1.2.3