Question
Hello, I'm doing the CMSC 330 Project 2 assignment. I have most of it finished but need assistance with the final part. I'm able to
"Hello, I'm doing the CMSC 330 Project 2 assignment. I have most of it finished but need assistance with the final part. I'm able to get the results to show on my console but I don't know how to pass the results to the rest of the program. I can get the variable "line" to the console. How do I pass it to the rest of the program? Thank you See below my main().
#include
#include
#include
using namespace std;
#include "expression.h"
#include "subexpression.h"
#include "symboltable.h"
#include "parse.h"
SymbolTable symbolTable;
void parseAssignments();
int main(){
Expression* expression;
char paren;
char comma;
string line;
ifstream inputFile("text.txt");
if (inputFile.is_open()) {
while (getline(inputFile, line)) {
cout << line << ' ';
}
inputFile.close();
}
else
cout << "File is not open" << ' ';
expression = SubExpression::parse();
cin >> comma;
parseAssignments();
cout << "Value = " << expression->evaluate() << endl;
cin.get();
return 0;
}
void parseAssignments(){
char assignop, delimiter;
string variable;
double value;
do{
variable = parseName();
cin >> ws >> assignop >> value >> delimiter;
symbolTable.insert(variable, value);
} while (delimiter == ',');
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started