Help with a function in my Stack implementation

Hi,

I have a class template Stack including the functions that are shown below. I want to implement the function calculate which calculates an aritmetic integer-expression with only (0-9)

I may only leap true expression ones and the adress with one characterat a time.

Every operation is surrounded by a pair of brackets. Its in the character string expression. I can assume that the it only contains the characters(, ), +, -, *, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and it doesnt include any errors.
An example of it is: (((6+3)*2)-((1+2)/3)) which results in 19.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
template <typename T>
class Stack
{
private:
    //some datastructure
public:
   Stack();
   virtual ~Stack();
   void push(T elem);
   T pop();
   T peek() const;
   bool empty() const;
};

//available functions
bool isDigit(char what);
int valueOfDigit(char what);

//to implement
int calculate(char expression[], int n);   //n is number of characters


Anybody who can help with this practice example?
Topic archived. No new replies allowed.