In C++ Programing, Write a program which will take a calculation from the user u
ID: 3676599 • Letter: I
Question
In C++ Programing, Write a program which will take a calculation from the user using a set of numbers and the operands +, -, *, / and will determine the result. Use the algorithm demonstrated in class to implement the solution, but do it using a singly linked list to emulate the stack ADT. You can exclude parentheses.
must use strings,can't use stack ADT and must use Class nodes not structure.
end result example:::
user inputs::: 123+2-2*1*4/
// Then will ask user if they would like to continue or end and solve the equation //
continue (Y) or End (N)
// if user press (N) then the output will be //
example output :: 4
//but if user enters (Y) then it would ask for a operation input then a number and another operation and ask the:: Continue(Y) or End (N) :: command again //
Explanation / Answer
#include #include #include #include const int MAX = 50 ; class postfix { private : int stack[MAX] ; int top, nn ; char *s ; public : postfix( ) ; void setexpr ( char *str ) ; void push ( int item ) ; int pop( ) ; void calculate( ) ; void show( ) ; } ; postfix :: postfix( ) { top = -1 ; } void postfix :: setexpr ( char *str ) { s = str ; } void postfix :: push ( int item ) { if ( top == MAX - 1 ) coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.