C++ code using stack
<p>I am writing a program that is a simple expression checker. All the program is to do is to check if a given input by the user is well-formed or not. I have three files I am woring with. I will post portions of each below. My question is in the main.cpp under case one if I have it coded right. I'm new to stacks and am not sure if I coded it correctly on what I want to happen. Just in case the code is to get an expression followed by a : and if the input is <code>'('</code> then push on to stack and if answer is <code>)'</code> then get top and compare to see if they are pairs. Then output if the expression is well-formed or not. Thanks.</p>

<p>Here is  the code:</p>

<p>main.cpp</p>

<pre><code>switch (choice){
case 1: 
    cout &lt;&lt; "Current Setting: () " &lt;&lt; endl;
    cout &lt;&lt; "Enter your expression followed by a ; : " &lt;&lt; endl;
    do {

    cin &gt;&gt; answer;


    if (answer = '(')
        stack.push( '(' );
    else 
        if (answer = ')' )
        (stack.top() == '(')




            while (answer != ';');
</code></pre>

<p>Stack.h</p>

<pre><code>elemType top(void) const;
// precondition: this stack is not empty
// returns top element in this stack

// transformers
void push(const elemType&amp; item);
// precondition: this stack is not full
// adds item to this stack

void pop(void);
// removes top element from this stack if exist
// remains empty otherwise
</code></pre>
