0

Hey guys, I need help recognizing multiple digit numbers that are read so that I may push said number into a stack for future evaluation

For example: 22 3 + should evaluate to 25

When I input 22 3 +, my output is evaluated to 5

Any help/criticism is welcome

Here is what I have so far:

```
template <int size>
void Stack<size> :: fillStack()
{
string expression;
cout << "Enter a postfix expression and terminate it with a '$': ";
getline(cin, expression);
int n = expression.length();
for (int i = 0; i < n; i++)
{
if (!isStackFull())
{
if (isdigit(expression[i]))
{
float x = (static_cast<float>(expression[i]) - '0');
if (isdigit(expression[i+1]))
{
int b = i+1;
while(isdigit(expression[b]))
{
x = x*10 + (static_cast<float>(expression[i+1]) - '0');
b++;
}
stack[counter++] = x;
}
else
{
stack[counter++] = x;
}
}
else if (ispunct(expression[i]))
{
operate(expression[i]);
}
}
else
{
cout << "Error: Stack is Full" << endl;
exit(0); }
}
}
```