Driver Code
$ expr1 = "1 + 2*5 + 3" ; $ res = evaluate ( $ expr1 ) ; ( $ res == -1 ) ? print ( $ expr1 . " ▁ is ▁ Invalid STRNEWLINE " ) : print ( " Value ▁ of ▁ " . $ expr1 . " ▁ is ▁ " . $ res . " STRNEWLINE " ) ; $ expr2 = "1 + 2*3" ; $ res = evaluate ( $ expr2 ) ; ( $ res == -1 ) ? print ( $ expr2 . " ▁ is ▁ Invalid STRNEWLINE " ) : print ( " Value ▁ of ▁ " . $ expr2 . " ▁ is ▁ " . $ res . " STRNEWLINE " ) ; $ expr3 = "4-2 + 6*3" ; $ res = evaluate ( $ expr3 ) ; ( $ res == -1 ) ? print ( $ expr3 . " ▁ is ▁ Invalid STRNEWLINE " ) : print ( " Value ▁ of ▁ " . $ expr3 . " ▁ is ▁ " . $ res . " STRNEWLINE " ) ; $ expr4 = "1 + + 2" ; $ res = evaluate ( $ expr4 ) ; ( $ res == -1 ) ? print ( $ expr4 . " ▁ is ▁ Invalid STRNEWLINE " ) : print ( " Value ▁ of ▁ " . $ expr4 . " ▁ is ▁ " . $ res . " STRNEWLINE " ) ; ? >