Trying to write a program which analyzes a mathimatical equation, convert to postfix notation and then solves it?
<p>So the first half works just fine and does a great job of converting the equation to postfix notation but after that, the command prompt just sits there blinking. I want to convert to postfix and then solve the equation.Can I get any help on what I'm doing wrong? thanks!</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;stack&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;
using namespace std;

int priority(string item) //prioritizing the operators
{
    if(item == "(" || item == ")")
    {
        return 0;
    }
    else if(item == "+" || item == "-")
    {
        return 1;
    }
    else
    {
        return 2;
    }
}
int main()
{
    stack &lt;string&gt; myStack; // initializing the stack.
    stack &lt;int&gt; myNewStack; //used for part 2
    char line[256];
    char line2[256];
    cin.getline( line, 256); // this and the proceeding line get the input.
    string exp = line;
    string item;
    string postItem; //used for part 2
    string postFix; //used for part 2

    istringstream iss(exp);

    iss &gt;&gt; item;

    while(iss)
    {
        if(item != "+" &amp;&amp; item != "-" &amp;&amp; item != "/" &amp;&amp; item != "*" &amp;&amp; item != "(" &amp;&amp; item != ")") //If the char is a number
        {
            cout &lt;&lt; item;
            postFix = postFix + item;
        }
        else if(myStack.size() == 0) // If the stack is empty
        {
            myStack.push(item);
        }
        else if( item == "+" || item == "-" || item == "/" || item == "*") //If the char is an operator
        {
            if(priority(myStack.top()) &lt; priority(item)) // the item on the stack is greater priority than the array item
            {
                myStack.push(item);
            }
            else
            {
                while(myStack.size() &gt; 0 &amp;&amp; priority(myStack.top()) &gt;= priority(item)) //while the stack contains something, and the item on
                {
                    cout &lt;&lt; myStack.top();
                    postFix = postFix + myStack.top();
                    myStack.pop();
                }
                myStack.push(item);
            }
        }
        else if(item == "(") // left peren
        {
            myStack.push(item);
        }
        else if(item == ")") // right peren
        {
            while(myStack.top() != "(")
            {
                cout &lt;&lt; myStack.top();
                postFix = postFix + myStack.top();
                myStack.pop();

            }
            myStack.pop();
        }
        iss &gt;&gt; item;
    }
    while (myStack.size() &gt; 0 ) //When nothing is left to evaluate
    {
        cout &lt;&lt; myStack.top();
        postFix = postFix + myStack.top();
        myStack.pop();
    }

    //PART 2

    int x1;
    int x2;
    int x3;

    istringstream iss2(postFix);

    iss2 &gt;&gt; postItem;

    while(iss2)
    {
        if(postItem != "+" &amp;&amp; postItem != "-" &amp;&amp; postItem != "/" &amp;&amp; postItem != "*") //if its a number
        {
            int n;
            n = atoi(postItem.c_str());
            myNewStack.push(n);
        }
        else if( postItem == "+" || postItem == "-" || postItem == "/" || postItem == "*") //if its an operator
        {
            if(postItem == "+")
            {
                x1 = myNewStack.top();
                myNewStack.pop();
                x2 = myNewStack.top();
                myNewStack.pop();
                x3 = x1 + x2;
                myNewStack.push(x3);
            }
            else if(postItem == "-")
            {
                x1 = myNewStack.top();
                myNewStack.pop();
                x2 = myNewStack.top();
                myNewStack.pop();
                x3 = x1 - x2;
                myNewStack.push(x3);
            }
            else if(postItem == "/")
            {
                x1 = myNewStack.top();
                myNewStack.pop();
                x2 = myNewStack.top();
                myNewStack.pop();
                x3 = x1 * x2;
                myNewStack.push(x3);
            }
            else if(postItem == "*")
            {
                x1 = myNewStack.top();
                myNewStack.pop();
                x2 = myNewStack.top();
                myNewStack.pop();
                x3 = x1 / x2;
                myNewStack.push(x3);
            }

            iss2 &gt;&gt; postItem;
        }
    }
    cout &lt;&lt; "The conversion into infix notation is" + myNewStack.top() &lt;&lt; endl;
}
</code></pre>
