aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;