improve includes

* include project headers before system headers
* include own header files
* include all needed headers (<limits>)
don't expect EOF after term from input stream
replace complicated for_each with simple for-loop
get rid of calc(std::string&)
recognize malformed input terms

* read from input stream using std::getline()
* convert input term to istringstream
* fill variables with extraction operator >>