Question: In C + + Please Private member elements: A vector of structs named symbolTable where the struct contains 2 fields: name ( type string )

In C++ Please
Private member elements:
A vector of structs named symbolTable where the struct contains 2 fields: name (type
string) and value (type double).
Methods - Implement the following functions:
Implement the makeExpTree functions that accepts an exp as a string argument and
create expTree.
A bool function named readSymbol that accepts a filename (string) as argument and read
data from a file where each row has two values: a symbol name (string) and a value
(double). Function heading:
bool readSymbol (string fname)
Function return true if file is opened successfully, false otherwise.
A lookup function that accepts two arguments: string and value as show below:
bool lookup (string name, double & value)
function find the value from the symbolTable matching that of the given name. It return
false if the name is not found in the table.
A double function named eval that evaluates the expression tree and assign result to the
reference argument. This evaluation should handle expression with a mix of numbers (in
string form) and variables whose value can be found in symbolTable. Function heading:
bool eval (double & result);
function return the true if eval is successful, false otherwise. For this assignment, we will
assume that the expression is grammatically correct. As such, the only error will be the
result of missing symbol which is identified by the lookup function. A straightforward
implementation is to call a recursive version of the eval function that does all the work. It
will have the following heading:
bool eval(node string*rt, double& result);
Sample I/O
Create an appropriate main function that will test all the new features. For example, the main
could first read the data from a file by calling readSymbol. It then continue to ask user for infix
expression, create an exp tree and then call eval to evaluate and print the result.
Required Data Structure
You MUST use ExpTree class which derives from binary tree base class.
 In C++ Please Private member elements: A vector of structs named

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!