Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am currently working a calculator that uses this algorithm: shunting yard in visual basic, i have already converted the infix expression to a postfix expression, but when i execute it , it does absolutely nothing, i cant find the error ....help would be very appreciated,thanks in advance. salida is a queue with the postfix expression that i pass to the sub...
VB
If queueAux.Count > 0 Then
            For Each c As Char In queueAux
                If Char.IsDigit(c) Then
                    stackAux.Push(c) 
                Else
                    a = Convert.ToDouble(stackAux.Pop + "")
                    b = Convert.ToDouble(stackAux.Pop + "")
                    op = salida.Dequeue()
                    If op.Equals("+") Then
                        res = a + b
                        resConv = Convert.ToChar(res)
                        stackAux.Push(resConv)
                    End If
                End If
            Next
        Else
            If stackAux.Count = 1 Then
                Console.WriteLine("The result is " + stackAux.Peek)
            End If
        End If
    End Sub
Posted
Updated 15-Jul-15 14:53pm
v2
Comments
Sergey Alexandrovich Kryukov 15-Jul-15 21:29pm    
Perhaps, a debugger, to start with something... :-)
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900