While top of ' ops ' has same or greater precedence to current token , which is an operator . Apply operator on top of ' ops ' to top two elements in values stack .
while ( ! ops . empty ( ) && precedence ( ops . top ( ) ) >= precedence ( tokens [ i ] ) ) { int val2 = values . top ( ) ; values . pop ( ) ; int val1 = values . top ( ) ; values . pop ( ) ; char op = ops . top ( ) ; ops . pop ( ) ; values . push ( applyOp ( val1 , val2 , op ) ) ; }