Question: Assignments also should be modified to allow assignment to values that are should also floating point rather than just integers. This is C++ using namespace

Assignments also should be modified to allow assignment to values that are should also floating point rather than just integers. This is C++

using namespace std; #include "expression.h" #include "subexpression.h" #include "symboltable.h" #include "parse.h" SymbolTable symbolTable; void parseAssignments(stringstream &in); int main() { const int SIZE = 256; Expression *expression; char paren, comma, line[SIZE]; ifstream fin; fin = ifstream("input.txt"); if (!(fin.is_open())) { cout << "File did not open" << endl; system("pause"); return 1; } while (true) { symbolTable.init(); fin.getline(line, SIZE); if (!fin) break; stringstream in(line, ios_base::in); in >> paren; cout << line << " "; try { expression = SubExpression::parse(in); in >> comma; parseAssignments(in); int result = expression->evaluate(); cout << "Value = " << expression->evaluate() << endl; } catch (string message) { cout << message << endl; } } system("pause"); return 0; } //definition of the function parseAssignments() void parseAssignments(stringstream &in) { char assignop, delimiter; string variable; int value; symbolTable.init(); do { variable = parseName(in); in >> ws >> assignop >> value >> delimiter; symbolTable.insert(variable, value); } while (delimiter == ','); } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!