diff options
author | Adrian Kummerländer | 2013-10-19 14:47:53 +0200 |
---|---|---|
committer | Adrian Kummerländer | 2013-10-19 14:47:53 +0200 |
commit | 041a56a919ae49db46fa34adc8de90f0feb69bb0 (patch) | |
tree | dc3b9125eaf06d688c88c84223939123a531ab19 | |
parent | c04051c034a5de33ba25e3182191d854edbbb516 (diff) | |
download | SimpleParser-041a56a919ae49db46fa34adc8de90f0feb69bb0.tar SimpleParser-041a56a919ae49db46fa34adc8de90f0feb69bb0.tar.gz SimpleParser-041a56a919ae49db46fa34adc8de90f0feb69bb0.tar.bz2 SimpleParser-041a56a919ae49db46fa34adc8de90f0feb69bb0.tar.lz SimpleParser-041a56a919ae49db46fa34adc8de90f0feb69bb0.tar.xz SimpleParser-041a56a919ae49db46fa34adc8de90f0feb69bb0.tar.zst SimpleParser-041a56a919ae49db46fa34adc8de90f0feb69bb0.zip |
Added simple input loop to clc
-rw-r--r-- | clc.cc | 25 |
1 files changed, 11 insertions, 14 deletions
@@ -3,22 +3,19 @@ #include "src/parser.h" -int main() -{ +typedef std::numeric_limits<double> dbl; + +int main() { std::string inputTerm; + std::cout.precision(dbl::digits10); - std::cin >> inputTerm; - - try { - typedef std::numeric_limits<double> 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; |