diff options
author | HombreLaser <sebastian-440@live.com> | 2022-04-28 16:09:20 -0500 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2022-04-28 16:09:20 -0500 |
commit | 44ec4d12336e290ad8d1f6e1559e04bf19e79075 (patch) | |
tree | 98ec03572ff9cfe211b7691e3bb4c00f43c57530 /main.cpp | |
parent | 3fa0be1d2d3408b9fb2adbcf975fa49acd87e50d (diff) |
Corregido error de memoria
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; } |