diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -2,6 +2,7 @@ * FACULTAD DE CIENCIAS FÍSICO MATEMÁTICAS * Luis Sebastián Martínez Vega - LCC */ +#include <cstddef> #include <iterator> #include <ostream> #include <string> @@ -16,19 +17,20 @@ using std::string, std::cin, std::cout, std::getline, std::vector, std::begin, std::end, std::endl; -int main(){ +int main() { int counter = 1; string input; Parser parser; - Expression *tree, *simplified, *diff; + Expression *tree = NULL, *simplified = NULL, *diff = NULL; cout << ">> "; while(getline(cin, input)) { try { tree = parser.parse(input); } catch(const ParserException &e) { - cout << e.showMsg(); + cout << e.showMsg() << "\n"; cout << ">> "; + tree = NULL; continue; } @@ -40,6 +42,9 @@ int main(){ delete tree; delete simplified; delete diff; + tree = NULL; + simplified = NULL; + diff = NULL; ++counter; } |