A program, named p7.cpp, that behaves in the manner describe in programming assignment 6, but which incorporates the changes listed below.

computer science

Description

Programming assignment 7 Due date and time: 11:59 PM, October 12, 2019 Problem: Write a program, named p7.cpp, that behaves in the manner describe in programming assignment 6, but which incorporates the changes listed below. As this is a C++ program, implementations of new features should use C++ conventions, libraries and I/O, except as specifically noted below.  Add support for declaring variables and using the variables declared in performing subsequent calculations. o The syntax for declaring a variable is “=”. Note that this use of the ‘=’ symbol is to perform an assignment of the value at the top of the stack to the name given in the assignment operation, not the operator used to terminate operation of the program and return results. o A valid variable name is composed of alphanumeric characters, with the first character an alphabetic character. Both upper- and lower-case alphabetic characters are permissible, and variable names are case-sensitive. o All operators defined in prior assignments are to be treated as reserved words, and thus cannot be used as variable names. o When an assignment is read from the stdin input stream, the name is to be checked for prior declaration. If previously declared, pop the value from the top of the stack and assign that value to the variable. If it has not been previously declared, add the name to the list of declared variables, pop the value from the top of the stack and assign that value to the newly declared variable. o Attempts to declare a variable when the stack is empty results in a stack underflow, which must already be treated as an error condition as per prior assignments. o When a declared variable name is encountered in the input stream, push the value of the variable onto the stack. o Handling of the name of the variable may, as the sole exception, be handled using the cstring library functions.  You are to implement retention of the list of declared variables as a circular doubly linked list of structures. These structures must contain space for a string to contain the name of the variable, a double allocation to hold the assigned value, and forward and backward links to other structures of the same type. o A circular doubly linked list is a linked list that has the head and the tail linked to a header node that is not itself part of the linked list. The advantage of this added node is that if you are searching for a particular item in the linked list, you can place that items identifier in the header node, then search the list without checking for the end of the list, since the value will always be found in the header, which is the “next” node for the tail of the list. Failure can be tested for by checking whether the node the item was found in was the header node. Being doubly linked, the list can be traversed from either end, and you can change direction of traversal at need. Naming: Your submitted file is to be named p7.cpp. This will be the last pure C program of the semester.


Related Questions in computer science category