Converting a char "number" into a real int
<p>I'm wanting to take the input of a user (mathematic expression) and push it onto a stack. Then I want to run it through some rules which ask if its a '(', a number, or an operator '+'. My problem is so far I don't know how to tell, specifically stating inside the while loop's first if statement, if a char is "actually" a number. Any suggestions?</p>

<pre><code>#include &lt;stack&gt;

int main()
{
    std::stack&lt;char&gt; myStack;    // initializing the stack
    char line[40]; 
    cin.getline(line, 40);       // this and the proceeding line get the input

    for (int i = 0; i &lt; 40; i++)
        myStack.push(line[i]);   //pushing all of the char onto the stack.

    while (!myStack.empty()) {
        if (myStack item = a number) {
        // ^ this is where it doesn't compile.
        //   I need to figure out how to find out if a char is a number
            cout &lt;&lt; item &lt;&lt; endl;
        }
        else if (myStack.empty()) {
            myStack.push(item);
        }
    }
}
</code></pre>
