The problem “Darray stack” is splitted into 2 subproblems:
You should solve this subproblem first.
In this subproblem, you have to implement a stack class, Darray_stack, which uses the Darray class you have implemented in "13873 - Dynamic Array 2" as its internal representation.
Here is the structure of Darray_stack:
class Darray_stack{
public:
Darray_stack();
void operator << (const int&);
void operator >> (int&);
int size(){
return arr.length();
}
private:
Darray arr;
};
You have to implement 3 public member functions for Darray_stack:
The first line is a string which only contains digits, representing the input of the verify function.
The second line is a postfix expression.
Constraints:
All numbers in the expression are nonnegative and are less than or equal to 100.
The length of the expression is no more than 250.
The length of the verify input code is no more than 10000.
The operators would only be '+', '-' or '*'.
It is guaranteed the numbers won't exceed 109 during the whole calculation process.
Output the verify code.