aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerländer2013-10-19 14:47:53 +0200
committerAdrian Kummerländer2013-10-19 14:47:53 +0200
commit041a56a919ae49db46fa34adc8de90f0feb69bb0 (patch)
treedc3b9125eaf06d688c88c84223939123a531ab19
parentc04051c034a5de33ba25e3182191d854edbbb516 (diff)
downloadSimpleParser-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.cc25
1 files 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<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;